mod = 10 ** 9 + 7

N, *A = map(int, open(0).read().split())

B = [0] * 62
for a in A:
    for i in range(62):
        if a >> i & 1:
            B[i] += 1

ans = 0
for i, b in enumerate(B):
    ans += ((N - b) * b % mod) * pow(2, i, mod)
    ans %= mod

print(ans)
