N=int(input())
A=list(map(int,input().split()))
dp=[0]*61
for i in range(N):
  a=len(bin(A[i]))-2
  for j in range(a):
    if A[i]&1==1:
      dp[j]+=1
    A[i]=A[i]>>1
ans=0
mod=10**9+7
for i in range(60,-1,-1):
  ans+=pow(2,i)*dp[i]*(N-dp[i])
  ans%=mod
print(ans)