n=int(input())
A=list(map(int,input().split()))
  
keta=[0]*60
for i in range(n):
  tar=A[i]
  ind=0
  while tar>0:
    if tar&1==1:
      keta[ind]+=1
    tar>>=1
    ind+=1

pair=[0]*60
for i in range(len(keta)):
  pair[i]=keta[i]*(len(A)-keta[i])
  
ans=0
mul=1
DIV=10**9+7
for i in range(len(pair)):
  ans+=pair[i]*mul
  ans%=DIV
  mul*=2
print(ans)
