#K50682. Singleton Number

    ID: 28919 Type: Default 1000ms 256MiB

Singleton Number

Singleton Number

Given an array of integers, every element appears twice except for one. Your task is to find that single number using an efficient bitwise algorithm. A particularly useful property is that for any integer \(a\), the operation \(a \oplus a = 0\) and \(a \oplus 0 = a\). By applying the XOR operation sequentially to all numbers in the array, you can isolate the unique element.

inputFormat

The input consists of two lines:

  • The first line contains a single integer \(n\), representing the number of elements in the array.
  • The second line contains \(n\) space-separated integers.

outputFormat

Output a single integer representing the number that appears only once in the array.

## sample
1
1
1