MOD=10**9+7
def XOR(x,y):
  ans=bin(x^y)
  return int(ans,2)
n=int(input())
d=list(map(int,input().split()))
m=1
a=0
for j in range(n):
  for i in range(m,n):
    a+=XOR(d[j],d[i])
  m+=1
print(a%MOD)
    