N = int(eval(input()))



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



ones = [0] * 60

m = 10 ** 9 + 7



for Ai in A:

    for digit in range(len(bin(Ai)) - 2):

        ones[digit] += ((Ai >> digit) & 1)



res = 0

for i, num in enumerate(ones):

    res += (1 << i) * num * (N - num)



print((res % m))

N = int(eval(input()))



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



ones = [0] * 60

m = 10 ** 9 + 7



for Ai in A:

    for digit in range(60):

        ones[digit] += ((Ai >> digit) & 1)



res = 0

for i, num in enumerate(ones):

    res += (1 << i) * num * (N - num)



print((res % m))

N = int(eval(input()))
A = list(map(int, input().split()))
ones = [0] * 60
m = 10**9 + 7
for Ai in A:
    for digit in range(len(bin(Ai)) - 2):
        ones[digit] += (Ai >> digit) & 1
res = 0
for i, num in enumerate(ones):
    res += (1 << i) * num * (N - num)
print((res % m))

N = int(eval(input()))
A = list(map(int, input().split()))
ones = [0] * 60
m = 10**9 + 7
for Ai in A:
    for digit in range(60):
        ones[digit] += (Ai >> digit) & 1
res = 0
for i, num in enumerate(ones):
    res += (1 << i) * num * (N - num)
print((res % m))

-    for digit in range(len(bin(Ai)) - 2): +    for digit in range(60):