def sumXOR( arr,  n): 

    sum = 0

    for i in range(0, 100): 

        zc = 0

        oc = 0

        idsum = 0

        for j in range(0, n): 

            if (arr[j] % 2 == 0): 

                zc = zc + 1

                  

            else: 

                oc = oc + 1

            arr[j] = arr[j]//2

        idsum = oc * zc * (1 << i)    

        sum = sum + idsum;  

        sum%=10**9+7

    return sum



n=int(eval(input()))

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

sum = sumXOR(arr, n); 

sum%=10**9+7

print(sum)
n=int(eval(input()))

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

mod=10**9+7

ct0=[0]*64

ct1=[0]*64

for i in range(n):

  x=format(a[i],'0'+str(64)+'b')

  for j in range(64):

    if x[j]=='0':

      ct0[j]+=1

    else:

      ct1[j]+=1

ct0.reverse()

ct1.reverse()

ans=0

for i in range(64):

  x=(ct0[i]*ct1[i])%mod

  ans+=x*(2**i)

  ans%=mod

print(ans)
def sumXOR(arr, n):
    sum = 0
    for i in range(0, 100):
        zc = 0
        oc = 0
        idsum = 0
        for j in range(0, n):
            if arr[j] % 2 == 0:
                zc = zc + 1
            else:
                oc = oc + 1
            arr[j] = arr[j] // 2
        idsum = oc * zc * (1 << i)
        sum = sum + idsum
        sum %= 10**9 + 7
    return sum


n = int(eval(input()))
arr = list(map(int, input().split()))
sum = sumXOR(arr, n)
sum %= 10**9 + 7
print(sum)

n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ct0 = [0] * 64
ct1 = [0] * 64
for i in range(n):
    x = format(a[i], "0" + str(64) + "b")
    for j in range(64):
        if x[j] == "0":
            ct0[j] += 1
        else:
            ct1[j] += 1
ct0.reverse()
ct1.reverse()
ans = 0
for i in range(64):
    x = (ct0[i] * ct1[i]) % mod
    ans += x * (2**i)
    ans %= mod
print(ans)

-def sumXOR(arr, n): -    sum = 0 -    for i in range(0, 100): -        zc = 0 -        oc = 0 -        idsum = 0 -        for j in range(0, n): -            if arr[j] % 2 == 0: -                zc = zc + 1 -            else: -                oc = oc + 1 -            arr[j] = arr[j] // 2 -        idsum = oc * zc * (1 << i) -        sum = sum + idsum -        sum %= 10**9 + 7 -    return sum - - -arr = list(map(int, input().split())) -sum = sumXOR(arr, n) -sum %= 10**9 + 7 -print(sum) +a = list(map(int, input().split())) +mod = 10**9 + 7 +ct0 = [0] * 64 +ct1 = [0] * 64 +for i in range(n): +    x = format(a[i], "0" + str(64) + "b") +    for j in range(64): +        if x[j] == "0": +            ct0[j] += 1 +        else: +            ct1[j] += 1 +ct0.reverse() +ct1.reverse() +ans = 0 +for i in range(64): +    x = (ct0[i] * ct1[i]) % mod +    ans += x * (2**i) +    ans %= mod +print(ans)