n=int(input())
l=sorted(list(map(int,input().split())))
bitlist=[]
num=l[-1]
b1=[]
while num!=0:
  b1.append(num%2)
  num//=2
bitlist.append(b1)
for i in range(2,n+1):
  num=l[-i]
  b1=[]
  while num!=0 or len(b1)<len(bitlist[0]):
    b1.append(num%2)
    num//=2
  bitlist.append(b1)
d={}
for i in range(len(bitlist[0])):
  d[i]=0
  for j in range(n):
    d[i]+=bitlist[j][i]
ans=0
for i in d:
  ans=(ans+(2**i)*(n-d[i])*d[i])%(10**9+7)
print(ans)