n = int(eval(input()))

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

ans = 0

for j in range(61):

  c = 0

  for i in A:

    if i>>j & 1:

      c += 1

  ans += 2**j*((n-c)*c)

print((ans%(10**9+7)))
import numpy as np

 

MOD = 10 ** 9 + 7

 

N = int(eval(input()))

A = np.array(list(map(int, input().split())),np.int64)

 

answer = 0

for n in range(63):

    B = (A >> n) & 1

    x = np.count_nonzero(B)

    y = N - x

    x *= y

    for _ in range(n):

        x *= 2

        x %= MOD

    answer += x

answer %= MOD

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

import numpy as np

MOD = 10**9 + 7
N = int(eval(input()))
A = np.array(list(map(int, input().split())), np.int64)
answer = 0
for n in range(63):
    B = (A >> n) & 1
    x = np.count_nonzero(B)
    y = N - x
    x *= y
    for _ in range(n):
        x *= 2
        x %= MOD
    answer += x
answer %= MOD
print(answer)

-n = int(eval(input())) -A = list(map(int, input().split())) -ans = 0 -for j in range(61): -    c = 0 -    for i in A: -        if i >> j & 1: -            c += 1 -    ans += 2**j * ((n - c) * c) -print((ans % (10**9 + 7))) +import numpy as np + +MOD = 10**9 + 7 +N = int(eval(input())) +A = np.array(list(map(int, input().split())), np.int64) +answer = 0 +for n in range(63): +    B = (A >> n) & 1 +    x = np.count_nonzero(B) +    y = N - x +    x *= y +    for _ in range(n): +        x *= 2 +        x %= MOD +    answer += x +answer %= MOD +print(answer)