import numpy as np
mod = 1000000007

n = int(input())
a = np.asarray(list(map(int, input().split())))
ans = 0
bit = 1
for i in range(60):
  n_one = np.sum(a & 1)
  ans += n_one * (n - n_one) * bit
  a >>= 1
  bit *= 2
print(ans % mod)