n = int(input())
a = list(map(int, input().split()))
bit = [[n,0] for i in range(60)]
b = []
ans = 0
mod = 10 ** 9 + 7
for i in a:
  b.append(bin(i)[2:])
for i in b:
  for k,j in enumerate(i[::-1]):
    j = int(j)
    if j:
      bit[k][0] -= 1
      bit[k][1] += 1
for k,(z,o) in enumerate(bit):
  ans = (ans + (z * o) * ((2 ** k) % mod)) % mod
print(ans)