import sys
input = sys.stdin.readline
import numpy as np

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