N = int(eval(input()))

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

MOD = 10**9 + 7



bit = [0] * 61

for i in range(N):

    for x in range(61):

        if 2**x > A[i]:

            break

        elif (1<<x) & A[i] > 0:

            bit[x] += 1



ans = 0

for i in range(61):

    ans += 2**i * (bit[i] * (N-bit[i]))

    ans %= MOD



print(ans)
N = int(eval(input()))

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

MOD = 10**9 + 7



bit = [0] * 61

for i in range(N):

    for x in range(61):

        if 2**x > A[i]:

            break

        else:

            bit[x] += (A[i]>>x)&1



ans = 0

for i in range(61):

    ans += 2**i * (bit[i] * (N-bit[i]))

    ans %= MOD



print(ans)
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
bit = [0] * 61
for i in range(N):
    for x in range(61):
        if 2**x > A[i]:
            break
        elif (1 << x) & A[i] > 0:
            bit[x] += 1
ans = 0
for i in range(61):
    ans += 2**i * (bit[i] * (N - bit[i]))
    ans %= MOD
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
bit = [0] * 61
for i in range(N):
    for x in range(61):
        if 2**x > A[i]:
            break
        else:
            bit[x] += (A[i] >> x) & 1
ans = 0
for i in range(61):
    ans += 2**i * (bit[i] * (N - bit[i]))
    ans %= MOD
print(ans)

-        elif (1 << x) & A[i] > 0: -            bit[x] += 1 +        else: +            bit[x] += (A[i] >> x) & 1