n = int(input())
a = list(map(int, input().split()))

MOD = 10**9 + 7

ans = 0
for k in range(60):
  c0 = 0
  c1 = 0
  for x in a:
    if bin(x)[2:].zfill(60)[-k - 1] == '1':
      c1 += 1
    else:
      c0 += 1

  ans += (c0 * c1) * (2 ** k)
  ans %= MOD

print(ans)
