#C1065. Unique Sorted Sum

    ID: 39878 Type: Default 1000ms 256MiB

Unique Sorted Sum

Unique Sorted Sum

Given an array of integers, your task is to compute the sum of all integers that appear exactly once in the array. In other words, an integer is considered unique if its frequency is 1. For example, for the array [1, 2, 2, 4, 5, 6, 6, 7], the unique numbers are 1, 4, 5, and 7, and their sum is 17.

Note: Use efficient algorithms to process large inputs. The condition for uniqueness can be represented as (\text{frequency}(a_i)=1).

inputFormat

The first line contains an integer (n), which is the number of elements in the array. The second line contains (n) space-separated integers.

outputFormat

Output a single integer representing the sum of all unique integers from the array.## sample

8
1 2 2 4 5 6 6 7
17