n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 1e9 + 7
digit = 1
for i in range(60):
  one = 0
  for aa in a:
    if (aa >> i) & 1:
      one += 1
  ans += (one * (n - one) * digit) % mod
  ans %= mod
  digit *= 2

print(int(ans))
