n=int(input())
a=list(map(int,input().split()))
b=[61*[0]for _ in range(n)]
c=[0]*61
for i in range(n):
  s=bin(a[i])[2:].zfill(61)
  for j in range(61):
    if s[-j-1]=="1":
      c[j]+=1
      b[i][j]=1
ans=0
mod=10**9+7
mod*=2
for i in range(n):
  x=1
  for j in range(61):
    if b[i][j]==1:s=n-c[j]
    else:s=c[j]
    ans+=s*x
    x=(x*2)%mod
    ans%=mod
print(ans//2)
