N, *A = map(int, open(0).read().split())
MOD = 1_000_000_007
ans = 0
for i in range(61):
    p, q, = 0, 0
    for a in A:
        if a >> i & 1:
            p += 1
        else:
            q += 1
    ans += pow(2, i, MOD) * p * q
    ans %= MOD
print(ans)