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



MOD = 10 ** 9 + 7

ans = 0

for bit in range(60):

    ctr = [0, 0]

    for i in range(N):

        ctr[A[i] >> bit & 1] += 1

    ans += (1 << bit) * (ctr[0] * ctr[1])

    ans %= MOD

    

print(ans)

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



mod = 10 ** 9 + 7

ans = 0

for bit in range(60):

    ctr = [0, 0]

    for i in range(N):

        ctr[A[i] >> bit & 1] += 1

    ans += (1 << bit) * (ctr[0] * ctr[1])

    ans %=mod

print(ans)

N, *A = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
ans = 0
for bit in range(60):
    ctr = [0, 0]
    for i in range(N):
        ctr[A[i] >> bit & 1] += 1
    ans += (1 << bit) * (ctr[0] * ctr[1])
    ans %= MOD
print(ans)

N, *A = list(map(int, open(0).read().split()))
mod = 10**9 + 7
ans = 0
for bit in range(60):
    ctr = [0, 0]
    for i in range(N):
        ctr[A[i] >> bit & 1] += 1
    ans += (1 << bit) * (ctr[0] * ctr[1])
    ans %= mod
print(ans)

-MOD = 10**9 + 7 +mod = 10**9 + 7 -    ans %= MOD +    ans %= mod