mod = int(1e9 + 7)
N = int(input())
A = [format(i, '060b') for i in map(int, input().split())]
S = 0
j = 1
for k in range(60):
  s = [A[i][59-k] for i in range(N)]
  v = s.count('0')*s.count('1')
  S += (v * j) % mod
  j *= 2
  j %= mod
  S %= mod
S %= mod
print(S)