#P1469. Lonely Chopstick

    ID: 14755 Type: Default 1000ms 256MiB

Lonely Chopstick

Lonely Chopstick

After a period of intense preparation, the computer group's "RP Restaurant" has finally opened. On its opening day, Manager LXC received a very large order, and the employees were excited to deliver the meal. However, at the moment of delivery, they encountered a sticky issue: the chopsticks!

CX found all the chopsticks in the restaurant but, unfortunately, they are of varying lengths. As we all know, a pair of chopsticks requires the two sticks to be of equal length. The twist is that although the total number of chopsticks is odd, only one chopstick is left without its pair while every other chopstick can form a pair with another chopstick of the same length. Your task is to find and output the length of the lone chopstick.

Note: It is known that for any two chopsticks to form a pair, they must have the same length. In other words, if the chopstick lengths are represented as numbers, you need to find the number that appears an odd number of times, where the rest appear exactly twice. You might find the XOR operation useful since it satisfies the following property in \( \LaTeX \):

\( a \oplus a = 0 \) and \( a \oplus 0 = a \).

inputFormat

The first line contains an odd integer \( n \) representing the total number of chopsticks. The second line contains \( n \) integers separated by spaces, each representing the length of a chopstick.

outputFormat

Output a single integer which is the length of the lone chopstick that cannot form a pair.

sample

3
1 2 1
2