p = 10**9+7

N = int(eval(input()))

A = list(input().split())

B = [0 for _ in range(N)]

for i in range(N):

    a = A[i]

    b = bin(int(a))[2:]

    b = "0"*(60-len(b))+b

    B[i] = b

C = {i:0 for i in range(60)}

for j in range(60):

    cnt = 0

    for i in range(N):

        if B[i][j]=="1":

            cnt += 1

    C[j] = cnt

tot = 0

for j in range(60):

    n = C[j]

    k = (N*(N-1))//2-(n*(n-1))//2-((N-n)*(N-n-1))//2

    tot = (tot+k*(2**(60-1-j)))%p

print(tot)
p0 = 10**9+7

def pow(x,m):

    if m==0:

        return 1

    if m==1:

        return x

    if m%2==0:

        return (pow(x,m//2)**2)%p0

    else:

        return (x*(pow(x,(m-1)//2)**2)%p0)%p0



N = int(eval(input()))

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

A = [bin(A[i])[2:] for i in range(N)]

A = ["0"*(60-len(A[i]))+A[i] for i in range(N)]

C = {k:0 for k in range(60)}

for i in range(N):

    for m in range(60):

        if A[i][m]=="1":

            C[59-m] += 1

B = [0 for _ in range(60)]

for k in range(60):

    p = C[k]

    m = N-C[k]

    B[k] = p*m

cnt = 0

for k in range(60):

    cnt = (cnt+B[k]*pow(2,k))%p0

print(cnt)
p = 10**9 + 7
N = int(eval(input()))
A = list(input().split())
B = [0 for _ in range(N)]
for i in range(N):
    a = A[i]
    b = bin(int(a))[2:]
    b = "0" * (60 - len(b)) + b
    B[i] = b
C = {i: 0 for i in range(60)}
for j in range(60):
    cnt = 0
    for i in range(N):
        if B[i][j] == "1":
            cnt += 1
    C[j] = cnt
tot = 0
for j in range(60):
    n = C[j]
    k = (N * (N - 1)) // 2 - (n * (n - 1)) // 2 - ((N - n) * (N - n - 1)) // 2
    tot = (tot + k * (2 ** (60 - 1 - j))) % p
print(tot)

p0 = 10**9 + 7


def pow(x, m):
    if m == 0:
        return 1
    if m == 1:
        return x
    if m % 2 == 0:
        return (pow(x, m // 2) ** 2) % p0
    else:
        return (x * (pow(x, (m - 1) // 2) ** 2) % p0) % p0


N = int(eval(input()))
A = list(map(int, input().split()))
A = [bin(A[i])[2:] for i in range(N)]
A = ["0" * (60 - len(A[i])) + A[i] for i in range(N)]
C = {k: 0 for k in range(60)}
for i in range(N):
    for m in range(60):
        if A[i][m] == "1":
            C[59 - m] += 1
B = [0 for _ in range(60)]
for k in range(60):
    p = C[k]
    m = N - C[k]
    B[k] = p * m
cnt = 0
for k in range(60):
    cnt = (cnt + B[k] * pow(2, k)) % p0
print(cnt)

-p = 10**9 + 7 +p0 = 10**9 + 7 + + +def pow(x, m): +    if m == 0: +        return 1 +    if m == 1: +        return x +    if m % 2 == 0: +        return (pow(x, m // 2) ** 2) % p0 +    else: +        return (x * (pow(x, (m - 1) // 2) ** 2) % p0) % p0 + + -A = list(input().split()) -B = [0 for _ in range(N)] +A = list(map(int, input().split())) +A = [bin(A[i])[2:] for i in range(N)] +A = ["0" * (60 - len(A[i])) + A[i] for i in range(N)] +C = {k: 0 for k in range(60)} -    a = A[i] -    b = bin(int(a))[2:] -    b = "0" * (60 - len(b)) + b -    B[i] = b -C = {i: 0 for i in range(60)} -for j in range(60): -    cnt = 0 -    for i in range(N): -        if B[i][j] == "1": -            cnt += 1 -    C[j] = cnt -tot = 0 -for j in range(60): -    n = C[j] -    k = (N * (N - 1)) // 2 - (n * (n - 1)) // 2 - ((N - n) * (N - n - 1)) // 2 -    tot = (tot + k * (2 ** (60 - 1 - j))) % p -print(tot) +    for m in range(60): +        if A[i][m] == "1": +            C[59 - m] += 1 +B = [0 for _ in range(60)] +for k in range(60): +    p = C[k] +    m = N - C[k] +    B[k] = p * m +cnt = 0 +for k in range(60): +    cnt = (cnt + B[k] * pow(2, k)) % p0 +print(cnt)