N, *A = list(map(int, open(0).read().split()))

mod = 10**9 + 7



ans = 0

for i in range(60):

    mask = 1 << i

    cnt = 0

    for a in A:

        if a & mask:

            cnt += 1

    x = cnt * (N-cnt)

    x *= mask % mod

    ans += x

    ans %= mod



print(ans)
import numpy as np

N, *A = list(map(int, open(0).read().split()))

A = np.array(A, dtype=np.int64)

mod = 10**9 + 7



ans = 0

for i in range(60):

    mask = 1 << i

    cnt = np.count_nonzero(A&mask)

    x = cnt * (N-cnt)

    x *= mask % mod

    ans += x

    ans %= mod



print(ans)
N, *A = list(map(int, open(0).read().split()))
mod = 10**9 + 7
ans = 0
for i in range(60):
    mask = 1 << i
    cnt = 0
    for a in A:
        if a & mask:
            cnt += 1
    x = cnt * (N - cnt)
    x *= mask % mod
    ans += x
    ans %= mod
print(ans)

import numpy as np

N, *A = list(map(int, open(0).read().split()))
A = np.array(A, dtype=np.int64)
mod = 10**9 + 7
ans = 0
for i in range(60):
    mask = 1 << i
    cnt = np.count_nonzero(A & mask)
    x = cnt * (N - cnt)
    x *= mask % mod
    ans += x
    ans %= mod
print(ans)

+import numpy as np + +A = np.array(A, dtype=np.int64) -    cnt = 0 -    for a in A: -        if a & mask: -            cnt += 1 +    cnt = np.count_nonzero(A & mask)