n = int(input())
A = list(map(int,input().split()))
C = [0 for i in range(60)]
mod = 1000000007
for a in A:
  for i in range(60):
    C[i] += a%2
    a>>=1
    if a==0:
      break
ans = 0
for i in range(60):
  u = (2**(i))%mod
  num = C[i]*(n-C[i])
  ans+=u*num
  ans%=mod
print(ans)