#C7164. Find the Unique Integer

    ID: 51005 Type: Default 1000ms 256MiB

Find the Unique Integer

Find the Unique Integer

You are given an array of integers in which each element appears exactly twice except for one unique element. Your task is to identify and print that unique integer.

The solution should use the properties of the bitwise XOR operation, specifically that $$x \oplus x = 0$$ and $$x \oplus 0 = x$$, to achieve an optimal time complexity of \(O(n)\) with a constant extra space \(O(1)\).

It is guaranteed that there is exactly one integer that occurs only once while all other integers appear exactly twice.

inputFormat

The input is given via standard input and consists of two lines:

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

outputFormat

Output the unique integer to standard output.

## sample
7
4 3 2 4 1 3 2
1

</p>