#K59197. Find the Unique Element
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 element, which appears only once. Your task is to find and output that unique element.
The problem can be efficiently solved using the bitwise XOR operator. Recall the following property of XOR:
$$a \oplus a = 0$$
and the fact that XOR is commutative and associative, which guarantees that the order of operations does not matter.
For example, if the input array is [4, 1, 2, 1, 2, 4, 5], the unique element is 5.
inputFormat
The input is read from standard input (stdin) as a single line of space-separated integers. The first integer n represents the number of elements in the array, followed by n integers.
For example: 7 4 1 2 1 2 4 5
outputFormat
Output the unique element that occurs only once in the array. The result should be printed to standard output (stdout).
## sample7 4 1 2 1 2 4 5
5