n = int(input())
A = list(map(int, input().split()))

mod = 10**9 + 7
d = 1
total = 0
while d < (1 << 60):
  cnt = 0
  for each in A:
    cnt += (each & d) != 0
  total += cnt * (n-cnt) * d
  total %= mod
  d <<= 1
print(total)
