#K57707. Sum of Unique Elements

    ID: 30480 Type: Default 1000ms 256MiB

Sum of Unique Elements

Sum of Unique Elements

Given a list of integers, your task is to compute the sum of all elements that appear exactly once in the list. Formally, if ( U ) is the set of integers that occur exactly once, you are to compute ( S = \sum_{x \in U} x ). The list may contain both positive and negative integers. You need to read the input from standard input (stdin) and write the result to standard output (stdout).

inputFormat

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

outputFormat

Output a single integer which is the sum of all unique elements in the list.## sample

7
1 2 2 3 4 5 5
8