N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 10 ** 9 + 7

for k in range(60):
  x, y = 0, 0
  for i in range(N):
    if A[i] >> k & 1:
      x += 1
  y = N - x
  ans += (x * y) * (2 ** k)
    
print(ans%mod)