You are given a sequence of N integer numbers A. Calculate the sum of Ai AND Aj for all the pairs (i, j) where i < j. 
 The AND operation is the Bitwise AND operation, defined as in here. 

Input
The first line of input consists of the integer N. 
The second line contains N integer numbers - the sequence A.

Output
Output the answer to the problem on the first line of the output.

Example
Input:
5
1 2 3 4 5

Output:
9


Scoring

Subtask 1 (13 points): N <= 1000, Ai <= 1. 
Subtask 2 (39 points): N <= 1000, Ai <= 10^9. 
Subtask 3 (21 points): N <= 10^5, Ai <= 1. 
Subtask 4 (27 points): N <= 10^5, Ai <= 10^6.
import math
import sys
def parseIntList(str):
 return [long(x) for x in str.split()]
def printBS(li):
 if len(li) is 0:
  print
 else:
  for i in range(len(li)-1):
   print li[i],
  print li[-1]
d={x:0 for x in range(32)}
def addTD(num):
 i=0
 while num!=0:
  d[i]+=num%2
  num/=2
  i+=1
n=input()
res=0
li=parseIntList(raw_input())
allZ=True
s=0
for i in li:
 if i>1:
  allZ=False
  break
 elif i==1: s+=1
if allZ: print s*(s-1)/2
else:
 for i in range(n):
  addTD(li[i])
 for x in d:
  res+=(d[x]*(d[x]-1)/2)*(2**x)
 print res