import numpy as np
MOD = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)
ans = 0
POW = 1
for j in range(60):
  tmp = A & 1
  one = sum(tmp)
  zero = N - one
  ans = (ans + one * zero * POW) % MOD
  A >>= 1
  POW = (POW*2)%MOD
print(ans%MOD)