import sys
input = sys.stdin.readline

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