mod = int(1e9 + 7)
N = int(input())
A = list(map(int, input().split()))
S = 0
j = 1
Z = [0 for i in range(N)]
while A != Z:
  m = 0
  n = 0
  for i in range(N):
    if A[i] % 2 == 1:
      m += 1
    else:
      n += 1
    A[i] //= 2
  S += ((m * n) * j) % mod
  j *= 2
  j %= mod
  S %= mod
S %= mod
print(S)