import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
N = ir()
A = lr()
bit = [0 for _ in range(60)]
for a in A:
    for i in range(a.bit_length()):
        if (a >> i) & 1:
            bit[i] += 1

answer = 0
for i, x in enumerate(bit):
    answer += x * (N-x) * 2 ** i % MOD

print(answer%MOD)
# 22