n=int(eval(input()))

lis=list([format(int(x),'b') for x in input().split()])

l=0

for i in range(n):

    l=max(l,len(lis[i]))



d0=[0]*60

d1=[0]*60



for i in range(n):

    lis[i]=lis[i].zfill(l)

    for j in range(l):

        if lis[i][-j-1]=='0':

            d0[j]+=1

        else:

            d1[j]+=1



ans=0

for i in range(60):

    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)

print((ans%(10**9+7)))
n=int(eval(input()))

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

ans=0

for i in range(60):

    l=0

    for ai in a:

        l+=(ai>>i)&1

    ans=(ans + 2**i * l * (n-l))%(10**9+7)

print(ans)
n = int(eval(input()))
lis = list([format(int(x), "b") for x in input().split()])
l = 0
for i in range(n):
    l = max(l, len(lis[i]))
d0 = [0] * 60
d1 = [0] * 60
for i in range(n):
    lis[i] = lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j - 1] == "0":
            d0[j] += 1
        else:
            d1[j] += 1
ans = 0
for i in range(60):
    ans += (d0[i] * d1[i] * 2**i) % (10**9 + 7)
print((ans % (10**9 + 7)))

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(60):
    l = 0
    for ai in a:
        l += (ai >> i) & 1
    ans = (ans + 2**i * l * (n - l)) % (10**9 + 7)
print(ans)

-lis = list([format(int(x), "b") for x in input().split()]) -l = 0 -for i in range(n): -    l = max(l, len(lis[i])) -d0 = [0] * 60 -d1 = [0] * 60 -for i in range(n): -    lis[i] = lis[i].zfill(l) -    for j in range(l): -        if lis[i][-j - 1] == "0": -            d0[j] += 1 -        else: -            d1[j] += 1 +a = list(map(int, input().split())) -    ans += (d0[i] * d1[i] * 2**i) % (10**9 + 7) -print((ans % (10**9 + 7))) +    l = 0 +    for ai in a: +        l += (ai >> i) & 1 +    ans = (ans + 2**i * l * (n - l)) % (10**9 + 7) +print(ans)