#Lutece1041. Hug the princess

Hug the princess

Migrated from Lutece 1041 Hug the princess

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

There is a sequence with nn elements. Assuming they are a1,a2,,ana_1, a_2, \cdots , a_n.

Please calculate the following expession.

$\displaystyle{\sum_{1\leq i < j \leq n} (a_i \wedge a_j)+(a_i | a_j)+(a_i \& a_j)}$

In the expression above, ^ | & is bit operation. If you don’t know bit operation, you can visit Bitwise operation to get some useful information.

Input

The first line contains a single integer nn, which is the size of the sequence.

The second line contains nn integers, the ithi_{th} integer aia_i is the ithi_{th} element of the sequence.

1n100000,0ai1000000001 \leq n \leq 100000, 0 \leq a_i \leq 100000000

Output

Print the answer in one line.

Samples

2
1 2
6

Note

Because the answer is so large, please use long long instead of int. Correspondingly, please use %lld instead of %d to scanf and printf.

Large input. You may get Time Limit Exceeded if you use "cin" to get the input. So "scanf" is suggested.

Likewise, you are supposed to use "printf" instead of "cout".

Resources

The 13th UESTC Programming Contest Preliminary