n=int(input())
a=sorted(list(map(int,input().split())))
a=a[::-1]
c=format(a[0],'b')
c=len(c)
m=10**9+7
zeros=[0]*c
power2=[1]*c
for i in range(n):
  a[i]=format(a[i],'b')
  a[i]=a[i][::-1]
  for j in range(len(a[i])):
    if a[i][j]=='1':
      zeros[j]+=1
for i in range(1,c):
  power2[i]=(power2[i-1]*2)%m
ans=0
for i in range(c):
  ans=(ans+zeros[i]*(n-zeros[i])*power2[i])%m
print(ans)