N = int(input())
A = list(map(int, input().split()))
digit = [0] * 60
for a in A:
  binary = bin(a)[-1:1:-1]
  for j in range(len(binary)):
    digit[j] += int(binary[j])
ans = 0
mod = 10**9+7
for i in range(60):
  ans += digit[i] * (N - digit[i]) * pow(2, i, mod)
  ans %= mod
print(ans)