N=input()
N=int(N)
A=[0]*60
B=list(map(int,input().split()))
for i in range(len(B)):
  for j in range(60):
    if(B[i]&(1<<j)):
      A[j]+=1
ans=0
for i in range(60):
  ans+=A[i]*(N-A[i])*(1<<i)
  ans%=1000000007
print(ans)