import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

res = 0
for b in range(60):
  bs = int((A >> b) & 1).sum()
  res = (res + bs*(N-bs) * (1 << b)) % 1000000007

print(res)
