N = int(eval(input()))

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

 

each_bit_sum = [{"0": 0, "1": 0} for _ in range(62)]

result = 0

for a in A:

    for i, b in enumerate(format(a, "b").zfill(62)[::-1]):

        each_bit_sum[i][b] += 1

 

for i, b in enumerate(each_bit_sum):

    result += ((b["0"] * b["1"]) * (2**i)) % ((10**9) + 7)

 

print((result % ((10**9) + 7)))
N = int(eval(input()))

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

 

result = 0

for i in range(60):

    on = sum([(1 << i) & a for a in A]) >> i

    result += (on * (N - on)) << i

    result %= ((10**9) + 7)

 

print(result)
N = int(eval(input()))
A = list(map(int, input().split()))
each_bit_sum = [{"0": 0, "1": 0} for _ in range(62)]
result = 0
for a in A:
    for i, b in enumerate(format(a, "b").zfill(62)[::-1]):
        each_bit_sum[i][b] += 1
for i, b in enumerate(each_bit_sum):
    result += ((b["0"] * b["1"]) * (2**i)) % ((10**9) + 7)
print((result % ((10**9) + 7)))

N = int(eval(input()))
A = list(map(int, input().split()))
result = 0
for i in range(60):
    on = sum([(1 << i) & a for a in A]) >> i
    result += (on * (N - on)) << i
    result %= (10**9) + 7
print(result)

-each_bit_sum = [{"0": 0, "1": 0} for _ in range(62)] -for a in A: -    for i, b in enumerate(format(a, "b").zfill(62)[::-1]): -        each_bit_sum[i][b] += 1 -for i, b in enumerate(each_bit_sum): -    result += ((b["0"] * b["1"]) * (2**i)) % ((10**9) + 7) -print((result % ((10**9) + 7))) +for i in range(60): +    on = sum([(1 << i) & a for a in A]) >> i +    result += (on * (N - on)) << i +    result %= (10**9) + 7 +print(result)