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 = int(eval(input()))

X = list(map(int, input().split()))



MOD = 10 ** 9 + 7

ans = 0

for b in range(61):

    ctr = [0, 0]

    for i in range(N):

        ctr[X[i] >> b & 1] += 1



    ans += (1 << b) * 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 = int(eval(input()))
X = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for b in range(61):
    ctr = [0, 0]
    for i in range(N):
        ctr[X[i] >> b & 1] += 1
    ans += (1 << b) * ctr[0] * ctr[1]
    ans %= MOD
print(ans)

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