n = int(eval(input()))

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

x = [0 for i in range(62)]

for i in range(n):

    b = bin(a[i])

    for i in range(len(b)-2):

        if b[-1-i] == '1':

            x[-i-1] += 1

mod = 10**9+7

ans = 0

two = 1

for i in range(1,62):

    ans = (ans + x[-i]*(n-x[-i])*two)%mod

    two = two*2%mod

print(ans)

n = int(eval(input()))

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

mod = 10**9+7



ans = 0

for i in range(60):

    c = sum([1 for ai in a if (ai >> i) & 1])

    ans += (1 << i) * c * (n-c)

    ans %= mod

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
x = [0 for i in range(62)]
for i in range(n):
    b = bin(a[i])
    for i in range(len(b) - 2):
        if b[-1 - i] == "1":
            x[-i - 1] += 1
mod = 10**9 + 7
ans = 0
two = 1
for i in range(1, 62):
    ans = (ans + x[-i] * (n - x[-i]) * two) % mod
    two = two * 2 % mod
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(60):
    c = sum([1 for ai in a if (ai >> i) & 1])
    ans += (1 << i) * c * (n - c)
    ans %= mod
print(ans)

-x = [0 for i in range(62)] -for i in range(n): -    b = bin(a[i]) -    for i in range(len(b) - 2): -        if b[-1 - i] == "1": -            x[-i - 1] += 1 -two = 1 -for i in range(1, 62): -    ans = (ans + x[-i] * (n - x[-i]) * two) % mod -    two = two * 2 % mod +for i in range(60): +    c = sum([1 for ai in a if (ai >> i) & 1]) +    ans += (1 << i) * c * (n - c) +    ans %= mod