#C5341. Sum of Unique Numbers

    ID: 48980 Type: Default 1000ms 256MiB

Sum of Unique Numbers

Sum of Unique Numbers

You are given an array of n integers. Your task is to compute the sum of all numbers that appear exactly once in the array. A number is unique if its frequency in the array is exactly 1, i.e., \( f(x) = 1 \).

For example, if the array is [1, 2, 2, 3, 4, 4], the unique numbers are 1 and 3, and their sum is 4.

Read the input from standard input (stdin) and print the result to standard output (stdout).

inputFormat

The input consists of two lines:

  1. The first line contains a single integer n (\(1 \le n \le 10^5\)) representing the number of elements in the array.
  2. The second line contains n space-separated integers. These integers can be negative, zero, or positive.

All input should be read from stdin.

outputFormat

Output a single integer to stdout: the sum of all the unique numbers (numbers that appear exactly once) in the array.

## sample
6
1 2 2 3 4 4
4

</p>