#K1876. Find the Odd Occurrence
Find the Odd Occurrence
Find the Odd Occurrence
You are given a list of integers. In this list, exactly one integer appears an odd number of times while all other integers appear an even number of times. Your task is to identify and print that integer. The input guarantees that there is one unique integer with an odd frequency.
In mathematical terms, if the list is denoted as \(a_1, a_2, \ldots, a_n\), find the unique \(x\) such that \(\#\{i\,|\,a_i = x\}\) is odd, and for every other integer \(y \neq x\), the count is even.
inputFormat
The first line contains an integer (n) representing the number of elements in the list. The second line contains (n) space-separated integers.
outputFormat
Print the integer that appears an odd number of times.## sample
7
1 2 3 1 3 2 3
3