N = int(input())
MOD = 10**9+7
a = [int(c) for c in input().split()]
ls = [0]*60
for i in range(N):
  m = a[i]
  for j in range(60):
    if m%2==1:
      ls[j] += 1
    m >>= 1

ans = 0
x = 1
for i in range(60):
  ans += x*(ls[i]*(N-ls[i]))
  ans %= MOD
  x *= 2
  x %= MOD
print(ans)