297. Add Up What Appears Once
Print the total of every value that appears exactly once. Values appearing twice or more contribute nothing at all, not even one copy.
1 2 3 2 -> 4 (1 + 3, since 2 appears twice)
Count everything first, then add up the values whose count is 1. Two passes, and the second one must walk the distinct values rather than the array, or values appearing once get added once and that is fine while values appearing twice get skipped twice, which is also fine. Either works here; counting first is what makes it possible.
Constraints - `1 ≤ n ≤ 200000` - `-1000000000 ≤ a[i] ≤ 1000000000`
Input
The first line contains an integer n.
The second line contains n integers.
Output
Print one integer, the sum of the values that appear exactly once.
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.