import numpy as np



N = int(eval(input()))

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



result = 0

for b in range(60):

  bs = int(((A >> b) & 1).sum())

  result = (result + bs * (N - bs) * (1 << b)) % 1000000007

print(result)

import numpy as np



N = int(eval(input()))

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



result = 0

for b in range(60):

  bs = int(((A >> b) & 1).sum())

  result = (result + bs * (N - bs) * (1 << b)) % 1000000007

print(result)

import numpy as np

N = int(eval(input()))
A = np.array(list(map(int, input().split())))
result = 0
for b in range(60):
    bs = int(((A >> b) & 1).sum())
    result = (result + bs * (N - bs) * (1 << b)) % 1000000007
print(result)

import numpy as np

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

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