#C10505. Winning Army
Winning Army
Winning Army
In this problem, you are given an integer (n) representing the number of armies and a sequence of (n) integers where each integer denotes the strength of an army. An army is said to survive if its strength appears an odd number of times in the list. Formally, if (f(s)) is the frequency of a particular strength (s), the army survives if (f(s) \bmod 2 = 1). If multiple armies survive, the winning army is the one with the minimum strength. If no army survives, output (-1).
inputFormat
The input is given via standard input. The first line contains a single integer (n) (the number of armies). The second line contains (n) space-separated integers representing the strengths of the armies.
outputFormat
Output a single integer via standard output: the strength of the winning army if one exists, or (-1) if no army survives.## sample
5
3 8 2 8 2
3
</p>