#C6014. Find the Unique Element

    ID: 49728 Type: Default 1000ms 256MiB

Find the Unique Element

Find the Unique Element

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

You can solve this problem using the bitwise XOR operator, which has the following properties:

  • \(a \oplus a = 0\)
  • \(a \oplus 0 = a\)

These properties ensure that XORing all the numbers in the array will cancel out the numbers that appear twice, leaving only the unique number.

inputFormat

The input is given via stdin in the following format:

n
x1 x2 x3 ... xn

Here, n is the number of elements in the array, and the second line contains n space-separated integers.

outputFormat

Output the unique element that appears only once in the array to stdout.

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