n = int(input())
A = list(map(int, input().split()))

mod = int(1e9 + 7)
ans = 0
for i in range(61):
    t = 0
    for a in A:
        if a >> i & 1:
            t += 1
    ans = (ans + pow(2, i, mod) * t * (n-t)) % mod
print(ans)