import numpy as np



data = int(eval(input()))

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

mod = 10 ** 9 + 7

counter = 0

for i in range(60):

    tmp = array & 1

    array >>= 1

    x = np.count_nonzero(tmp)

    x *= data - x

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

print(counter)
import numpy as np

 

data = int(eval(input()))

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

 

result = 0

for bit in range(60):

    array01 = int((array & 1).sum())

    result = (result + array01 * (data - array01) * (1 << bit)) % 1000000007

    array >>= 1

print(result)
import numpy as np

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

import numpy as np

data = int(eval(input()))
array = np.fromiter(list(map(int, input().split())), np.int64)
result = 0
for bit in range(60):
    array01 = int((array & 1).sum())
    result = (result + array01 * (data - array01) * (1 << bit)) % 1000000007
    array >>= 1
print(result)

-array = np.array(list(map(int, input().split()))) -mod = 10**9 + 7 -counter = 0 -for i in range(60): -    tmp = array & 1 +array = np.fromiter(list(map(int, input().split())), np.int64) +result = 0 +for bit in range(60): +    array01 = int((array & 1).sum()) +    result = (result + array01 * (data - array01) * (1 << bit)) % 1000000007 -    x = np.count_nonzero(tmp) -    x *= data - x -    counter = (counter + pow(2, i, mod) * x) % mod -print(counter) +print(result)