p = 10**9 + 7
n = int(input())
a = list(map(int,input().split()))
c = [0]*60
for x in a:
  y = x
  for i in range(60):
    c[i] += y%2
    y //= 2
q = 0
for i in range(60):
  q = (q + c[i]*(n-c[i])*2**i)%p
print(q)