Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/juftsiz-son

The unpaired number

Medium 1000 ms 64 MB 45%
Share

$n$ integers $a_{1}, a_{2}, \ldots, a_{n}$ are given. One value among them occurs exactly once, and each of the other values occurs an even number of times ($2$, $4$, $6$, $\ldots$ times). Find the value that occurs once.

A row of numbers: values occurring in pairs and the one left without a pair

Input

The first line contains an odd positive integer $n$. The second line contains $n$ integers $a_{i}$ separated by spaces.

Output

One integer — the value that occurs once.

Note

$1 \le n \lt 2 * 10^{5}$
$0 \le a_{i} \le 10^{18}$

Examples

Input #1
5
4 1 2 1 2
Output #1
4
Input #2
1
7
Output #2
7

Sign in to submit a solution

Signing up is free and takes a minute.