#C1337. Single Number
Single Number
Single Number
Given a list of integers of size \(n\), where every element appears exactly twice except for one unique element that appears only once, your task is to find this unique element.
The solution takes advantage of the bitwise XOR operation which has the property that \(a \oplus a = 0\) and \(a \oplus 0 = a\). Thus, the unique number can be found by computing:
\(result = a_1 \oplus a_2 \oplus \cdots \oplus a_n\)
Read the input from stdin and output the result to stdout.
inputFormat
The input consists of two lines:
- The first line contains a single integer \(n\), the number of elements in the list.
- The second line contains \(n\) space-separated integers.
outputFormat
Output a single integer, the element that appears only once in the list.
## sample3
2 2 1
1
</p>