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