N=int(input())
A=list(map(int,input().split()))
A=[format(A[i],'b').rjust(61,'0') for i in range(N)]
zero=[0 for i in range(61)]
one=[0 for i in range(61)]
for i in range(N):
   for j in range(61):
       if A[i][j]=='0':
         zero[60-j]+=1
       if A[i][j]=='1':
         one[60-j]+=1
mod=10**9+7       
ans=0
for i in range(61):
   ans+=zero[i]*one[i]*pow(2,i,mod)
   ans%=mod
print(ans)
       