#K95387. Find the Unique Element

    ID: 38852 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 determine and output this unique element.

An efficient solution involves using the XOR operation, since for any integer (a), (a \oplus a = 0) and (a \oplus 0 = a). Thus, the unique element can be found by calculating $$result = \bigoplus_{i=1}^{n} a_i$$ where (a_i) are the array elements.

inputFormat

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

outputFormat

Output a single integer, which is the unique element that appears exactly once.## sample

7
4 3 2 4 1 3 2
1