405847: GYM102134 H 3XOR

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. 3XORtime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard output

Like every Andrew, our Andrew likes arrays. And he likes to play with arrays and search for different interesting numbers. Once he got an array of integers A. The length of the array was n. Andrew decided to choose three indexes (possibly identical to each other) i, j, k and then calculated the bitwise exclusive or of numbers A[i], A[j] and A[k]. Andrew even invented the name 3XOR for this operation. After the euphoria passed, he wondered what would happen if you took all possible unordered combinations of the indexes i, j, k, used a new operation and then added all the results. It must be some number. Help Andrew solve this problem!

Input

The first line of input contains a number n. The next line contains array A.

3 ≤ n ≤ 104

0 ≤ A[i] ≤ 106

Output

Just output the answer

ExamplesInput
3
1 2 3
Output
42
Input
5
42 4 42 2 42
Output
2868

加入题单

上一题 下一题 算法标签: