import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
res = 0
t=1
for i in range(60):
  if i ==0:
    A =[divmod(x,2) for x in A]
    n = sum(y for x,y in A)
    res += n*(N-n)
  else:
    A = [divmod(x,2) for x,y in A]
    n = sum(y for x,y in A)
    t = t*2
    res += n*(N-n)*t
    if all(x==0 for x in A):
      break
print(res%(7+10**9))