n=int(eval(input()))

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

  

keta=[0]*60

for i in range(n):

  tar=A[i]

  ind=0

  while tar>0:

    if tar&1==1:

      keta[ind]+=1

    tar>>=1

    ind+=1



pair=[0]*60

for i in range(len(keta)):

  pair[i]=keta[i]*(len(A)-keta[i])

  

ans=0

mul=1

DIV=10**9+7

for i in range(len(pair)):

  ans+=pair[i]*mul

  ans%=DIV

  mul*=2

print(ans)

import numpy as np



N=int(eval(input()))

A=np.array(input().split(),dtype=int)



DIV=10**9+7



ans=0

for i in range(60):

  bits=(A>>i)&1

  nonzero=np.count_nonzero(bits)

  zeros=N-nonzero

  pat=nonzero*zeros

  for p in range(i):

    pat*=2

  ans+=pat

  ans%=DIV

  

print(ans)

n = int(eval(input()))
A = list(map(int, input().split()))
keta = [0] * 60
for i in range(n):
    tar = A[i]
    ind = 0
    while tar > 0:
        if tar & 1 == 1:
            keta[ind] += 1
        tar >>= 1
        ind += 1
pair = [0] * 60
for i in range(len(keta)):
    pair[i] = keta[i] * (len(A) - keta[i])
ans = 0
mul = 1
DIV = 10**9 + 7
for i in range(len(pair)):
    ans += pair[i] * mul
    ans %= DIV
    mul *= 2
print(ans)

import numpy as np

N = int(eval(input()))
A = np.array(input().split(), dtype=int)
DIV = 10**9 + 7
ans = 0
for i in range(60):
    bits = (A >> i) & 1
    nonzero = np.count_nonzero(bits)
    zeros = N - nonzero
    pat = nonzero * zeros
    for p in range(i):
        pat *= 2
    ans += pat
    ans %= DIV
print(ans)

-n = int(eval(input())) -A = list(map(int, input().split())) -keta = [0] * 60 -for i in range(n): -    tar = A[i] -    ind = 0 -    while tar > 0: -        if tar & 1 == 1: -            keta[ind] += 1 -        tar >>= 1 -        ind += 1 -pair = [0] * 60 -for i in range(len(keta)): -    pair[i] = keta[i] * (len(A) - keta[i]) +import numpy as np + +N = int(eval(input())) +A = np.array(input().split(), dtype=int) +DIV = 10**9 + 7 -mul = 1 -DIV = 10**9 + 7 -for i in range(len(pair)): -    ans += pair[i] * mul +for i in range(60): +    bits = (A >> i) & 1 +    nonzero = np.count_nonzero(bits) +    zeros = N - nonzero +    pat = nonzero * zeros +    for p in range(i): +        pat *= 2 +    ans += pat -    mul *= 2