Single Number

EasyBit Manipulation
Next
Bit ManipulationXORArray

In an array every value appears exactly twice, except for one value that appears once. Find that single value. Aim for linear time and constant extra space.

Input

Line 1: n (always odd). Line 2: n integers.

Output

Print the value that appears once.

Constraints

1 <= n <= 10^5, n is odd -3 * 10^4 <= each value <= 3 * 10^4

Example 1
Input
5
4 1 2 1 2
Output
4

1 and 2 cancel in pairs; 4 remains.

Hints

Single Number - Easy Bit Manipulation Problem | Skill Shiksha