n=int(input())
mod=10**9+7;ans=0
a=list(map(int,input().split()))
for i in range(61):
  checkbit=1 << i
  cnt=0
  for j in a:
    cnt+= (j & checkbit) // checkbit
  ans+=checkbit*cnt*(n-cnt)
  ans%=mod
print(ans)
