import sys
mod = 10 ** 9 + 7
N = int(input())
A = [int(i) for i in sys.stdin.readline().rstrip().split()]
ans = 0
for i in range(60):
  count = 0
  for data in A:
    if data & (1<<i):
      count += 1
  ans += ((count % mod) * ((N-count) % mod) * pow(2,i,mod)) % mod
print(ans%mod)