N = int(input())
A = map(int, input().split())
D = [[0, 0] for _ in range(60)]

for a in A:
    for i in range(60):
        if (a >> i) & 1:
            D[i][1] += 1
        else:
            D[i][0] += 1

ans = 0
mod = 10 ** 9 + 7

for idx, d in enumerate(D):
    ans += (d[0] * d[1] * (1 << idx)) % mod

print(ans)
