#K57012. Find the Unique Element in an Array

    ID: 30326 Type: Default 1000ms 256MiB

Find the Unique Element in an Array

Find the Unique Element in an Array

You are given an integer array in which every element appears exactly three times except for one element, which appears only once. Your task is to find the element that appears once.

Note: Your solution must run in linear time, O(n), and use only constant extra space. The algorithm should be efficient.

For example, if the input array is [2, 2, 3, 2], the output should be 3 because 3 appears only once.

Please read the input from standard input and print the answer to standard output.

inputFormat

The first line contains an integer n representing the number of elements in the array. The next line contains n space-separated integers representing the array.

outputFormat

Output a single integer which is the unique element that appears exactly once in the array.

## sample
4
2 2 3 2
3