N = int(input())
MOD = 1e+9 + 7
a = [int(i) for i in input().split()]

b = [0 for _ in range(60)]

for i in a:
  for j in range(60):
    b[j] += (i >> j) & 1

ans = 0
for i, j in enumerate(b):
  second = 1
  for _ in range(i):
    second *= 2
    second %= MOD
  ans += (j * (N - j)) * second
  ans %= MOD
  
print(int(ans))