#C6670. Find the Unique Element

    ID: 50456 Type: Default 1000ms 256MiB

Find the Unique Element

Find the Unique Element

Given an array of integers in which every element appears exactly twice except one that appears only once, your task is to identify and output this unique element. If no such element exists (i.e., every element appears in pairs), output 0.

You may solve this problem using the XOR operation. Recall the properties: $$a \oplus a = 0$$ and $$a \oplus 0 = a$$.

inputFormat

The input consists of two lines. The first line contains an integer N representing the number of elements in the array. The second line contains N space-separated integers.

outputFormat

Output a single integer: the unique element if it exists; otherwise, output 0.

## sample
5
1 2 3 2 1
3