import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
K = 60

ans = 0
mod = 10 ** 9 + 7
power = 1

for i in range(K):
    bit = sum(A >> i & 1)
    ans += power * ((bit * (N - bit)) % mod)
    power *= 2
    power %= mod
    ans %= mod

print(ans)