n = int(input())
a = list(map(lambda x: '{:060b}'.format(int(x)), input().split()))
ans = 0
mod = 10**9+7
for d in range(60):
  cnt = 0
  for i in range(n):
    if a[i][d] == '1':
      cnt += 1
  ans += 2 ** (59-d) * cnt * (n - cnt)
print(ans%mod)