#C5120. Find the Single Unique Number
Find the Single Unique Number
Find the Single Unique Number
You are given an array of integers where every element appears exactly twice except for one unique element. Your task is to find this unique element using efficient bit manipulation. Recall the property of the XOR operation:
\(a \oplus a = 0\) and \(a \oplus 0 = a\). Therefore, by XOR-ing all elements of the array, the paired elements cancel each other out, leaving the unique element.
The input starts with an integer n representing the number of elements, followed by n space-separated integers. Print the unique number as the result.
inputFormat
The first line of input contains a single integer n indicating the number of elements in the array. The second line contains n space-separated integers.
outputFormat
Output the integer that appears only once in the array.
## sample7
2 1 4 5 1 2 4
5
</p>