405847: GYM102134 H 3XOR
Description
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!
InputThe first line of input contains a number n. The next line contains array A.
3 ≤ n ≤ 104
0 ≤ A[i] ≤ 106
OutputJust output the answer
ExamplesInput3Output
1 2 3
42Input
5Output
42 4 42 2 42
2868