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

maxdig = 60

ans = 0
for i in range(60+1):
  d = 2**i
  cnt1 = 0
  for a in A:
    if (a >> i) & 1:
      cnt1 += 1
  ans += (cnt1*(N-cnt1)*d)
  ans = ans%1000000007

print(ans)