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

r = [0] * 60
for i in range(N):
  tmp = format(A[i], '060b')
  #print(tmp)
  for j in range(60):
    r[j] += int(tmp[j])

s = 0
for j in range(60):
  s += r[j] * (N - r[j]) * (2 ** (59-j))
  

print(s % (10**9 + 7))

#print(bin(10**9 + 7))