n=int(input())
A=list(map(int,input().split()))
mod = 10**9+7;ans=0
for i in range(60):
  cnt=0
  for a in A: cnt+=a>>i&1
  cnt=cnt*(n-cnt)%mod
  for i in range(i): cnt=cnt*2%mod
  ans+=cnt
print(ans%mod)