MOD = 10**9+7

n = int(eval(input()))

A = ['{:060b}'.format(a)[::-1] for a in map(int, input().split())]

A_d = []

for col in zip(*A):

    one_cnt = col.count('1')

    A_d.append(one_cnt*(n-one_cnt))



ans = 0

for d in range(60):

    ans = ans + A_d[d]*pow(2, d, MOD) % MOD

print((ans % MOD))

MOD = 10**9+7

n = int(eval(input()))

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

n_bit = 60

bit_cnt = [0]*n_bit

for i in range(n):

    for d in range(n_bit):

        if (A[i] >> d) & 1:

            bit_cnt[d] += 1



ans = 0

for d, one_cnt in enumerate(bit_cnt):

    ans = ans + one_cnt*(n-one_cnt)*pow(2, d, MOD) % MOD

print((ans % MOD))
MOD = 10**9 + 7
n = int(eval(input()))
A = ["{:060b}".format(a)[::-1] for a in map(int, input().split())]
A_d = []
for col in zip(*A):
    one_cnt = col.count("1")
    A_d.append(one_cnt * (n - one_cnt))
ans = 0
for d in range(60):
    ans = ans + A_d[d] * pow(2, d, MOD) % MOD
print((ans % MOD))

MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
n_bit = 60
bit_cnt = [0] * n_bit
for i in range(n):
    for d in range(n_bit):
        if (A[i] >> d) & 1:
            bit_cnt[d] += 1
ans = 0
for d, one_cnt in enumerate(bit_cnt):
    ans = ans + one_cnt * (n - one_cnt) * pow(2, d, MOD) % MOD
print((ans % MOD))

-A = ["{:060b}".format(a)[::-1] for a in map(int, input().split())] -A_d = [] -for col in zip(*A): -    one_cnt = col.count("1") -    A_d.append(one_cnt * (n - one_cnt)) +A = list(map(int, input().split())) +n_bit = 60 +bit_cnt = [0] * n_bit +for i in range(n): +    for d in range(n_bit): +        if (A[i] >> d) & 1: +            bit_cnt[d] += 1 -for d in range(60): -    ans = ans + A_d[d] * pow(2, d, MOD) % MOD +for d, one_cnt in enumerate(bit_cnt): +    ans = ans + one_cnt * (n - one_cnt) * pow(2, d, MOD) % MOD