#C2425. Sum of Unique Scores

    ID: 45740 Type: Default 1000ms 256MiB

Sum of Unique Scores

Sum of Unique Scores

Given a list of integer student scores, your task is to calculate the sum of scores that appear exactly once. In other words, if a score occurs more than once, it should not be included in the sum.

Mathematically, if we define a function f(x) that equals x when the score x appears exactly once in the list and 0 otherwise, you must compute:

[ \text{Result} = \sum_{x \in S} f(x), ]

where S is the set of scores in the input list.

Examples:

  • For the list [1, 2, 2, 3, 5, 6, 6], the unique scores are 1, 3, and 5, so the output is 9.
  • For the list [4, 4, 4, 4], there are no scores that occur exactly once, hence the output is 0.

inputFormat

The input is provided via standard input (stdin) and consists of two lines:

  1. The first line contains a single integer n representing the number of scores.
  2. The second line contains n space-separated integers, each representing a student's score.

It is guaranteed that n is non-negative. When n = 0, the second line will be empty.

outputFormat

Output a single integer via standard output (stdout), which is the sum of all scores that appear exactly once in the list.

## sample
7
1 2 2 3 5 6 6
9