M=10**9+7

n=int(eval(input()))

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

a=0

for i in range(60):

  t=sum((l[j]>>i)%2 for j in range(n))

  a+=(t*(n-t)<<i)%M

print((a%M))
M=10**9+7

n=int(eval(input()))

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

a=0

for i in range(60):

  t=sum(j>>i&1 for j in l)

  a+=(t*(n-t)<<i)%M

print((a%M))
M = 10**9 + 7
n = int(eval(input()))
l = list(map(int, input().split()))
a = 0
for i in range(60):
    t = sum((l[j] >> i) % 2 for j in range(n))
    a += (t * (n - t) << i) % M
print((a % M))

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

-    t = sum((l[j] >> i) % 2 for j in range(n)) +    t = sum(j >> i & 1 for j in l)