n = int(eval(input()))

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

mod = 10 ** 9 + 7



bit = [0] * 60

for a in A:

    i = 0

    while a > 0:

        bit[i] += a & 1

        i += 1

        a >>= 1



ans = 0

for i, x in enumerate(bit):

    x = x*(n-x)

    for _ in range(i):

        x *= 2

        x %= mod

    ans += x

    ans %= mod

print(ans)

import numpy as np

n = int(eval(input()))

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

mod = 10 ** 9 + 7



ans = 0

for i in range(64):

    tmp = (A >> i) & 1

    x = np.count_nonzero(tmp)

    x *= n - x

    ans += pow(2, i, mod) * x % mod



print((ans % mod))

n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
bit = [0] * 60
for a in A:
    i = 0
    while a > 0:
        bit[i] += a & 1
        i += 1
        a >>= 1
ans = 0
for i, x in enumerate(bit):
    x = x * (n - x)
    for _ in range(i):
        x *= 2
        x %= mod
    ans += x
    ans %= mod
print(ans)

import numpy as np

n = int(eval(input()))
A = np.array(list(map(int, input().split())))
mod = 10**9 + 7
ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod
print((ans % mod))

+import numpy as np + -A = list(map(int, input().split())) +A = np.array(list(map(int, input().split()))) -bit = [0] * 60 -for a in A: -    i = 0 -    while a > 0: -        bit[i] += a & 1 -        i += 1 -        a >>= 1 -for i, x in enumerate(bit): -    x = x * (n - x) -    for _ in range(i): -        x *= 2 -        x %= mod -    ans += x -    ans %= mod -print(ans) +for i in range(64): +    tmp = (A >> i) & 1 +    x = np.count_nonzero(tmp) +    x *= n - x +    ans += pow(2, i, mod) * x % mod +print((ans % mod))