from math import log2

N = int(input())
A = [int(i) for i in input().split()]

maxdig = 60

ans = 0
for i in range(60, -1, -1):
  d = 2**i
  cnt1 = 0
  for j in range(N):
    if A[j]//d > 0:
      cnt1 += 1
      A[j] -= d
  ans += (cnt1*(N-cnt1)*d)
  ans = ans%1000000007

print(ans)