N=int(eval(input()))

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

T=[0]*61

mod=10**9+7



for i in range(N):

  for j in range(61):

    if ((A[i]>>j) & 1):

      #print(i,j)

      T[j]+=1

#print(T)



ans=0

for i in range(61):

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

  ans%=mod

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

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



MOD = 10 ** 9 + 7

cnt = [0] * 61



for a in A:

  for i in range(61):

    cnt[i] += 1 if (a >> i) & 1 else 0



answer = 0

for i in range(61):

  answer = (answer + (2 ** i * cnt[i] * (N - cnt[i]))) % MOD

print(answer)
N = int(eval(input()))
A = list(map(int, input().split()))
T = [0] * 61
mod = 10**9 + 7
for i in range(N):
    for j in range(61):
        if (A[i] >> j) & 1:
            # print(i,j)
            T[j] += 1
# print(T)
ans = 0
for i in range(61):
    ans += 2**i * (N - T[i]) * T[i]
    ans %= mod
print(ans)

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

-A = list(map(int, input().split())) -T = [0] * 61 -mod = 10**9 + 7 -for i in range(N): -    for j in range(61): -        if (A[i] >> j) & 1: -            # print(i,j) -            T[j] += 1 -# print(T) -ans = 0 +A = tuple(map(int, input().split())) +MOD = 10**9 + 7 +cnt = [0] * 61 +for a in A: +    for i in range(61): +        cnt[i] += 1 if (a >> i) & 1 else 0 +answer = 0 -    ans += 2**i * (N - T[i]) * T[i] -    ans %= mod -print(ans) +    answer = (answer + (2**i * cnt[i] * (N - cnt[i]))) % MOD +print(answer)