#K1431. Find the Single Unique Number

    ID: 24106 Type: Default 1000ms 256MiB

Find the Single Unique Number

Find the Single Unique Number

You are given an array of integers in which every element appears exactly twice except for one element that appears only once. Your task is to find and output this unique number.

The problem can be mathematically formulated as: given an array \( A = [a_1, a_2, \ldots, a_n] \) where all elements except one satisfy \( a_i \oplus a_i = 0 \) (using the bitwise XOR operation), find the unique element \( x \) such that:

\[ \bigoplus_{i=1}^{n} a_i = x \]

It is guaranteed that exactly one element appears only once and all other elements appear exactly twice.

inputFormat

The first line contains a single integer \( n \) representing the number of elements in the array. The second line contains \( n \) space-separated integers representing the elements of the array.

outputFormat

Output a single integer — the unique number in the array.

## sample
3
2 2 1
1

</p>