import numpy as np



N = int(eval(input()))

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



result = 0

for bit in range(60):

  c = int((A & 1).sum())

  A >>= 1

  result = (result + c * (N - c) * (1 << bit)) % 1000000007

print(result)

import numpy as np



N = int(eval(input()))

A = np.fromstring(eval(input()), dtype = np.int64, sep = ' ')



result = 0

for bit in range(60):

    c = int((A & 1).sum())

    A >>= 1

    result = (result + c * (N - c) * (1 << bit)) % 1000000007

print(result)

import numpy as np

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

import numpy as np

N = int(eval(input()))
A = np.fromstring(eval(input()), dtype=np.int64, sep=" ")
result = 0
for bit in range(60):
    c = int((A & 1).sum())
    A >>= 1
    result = (result + c * (N - c) * (1 << bit)) % 1000000007
print(result)

-A = np.fromiter(list(map(int, input().split())), np.int64) +A = np.fromstring(eval(input()), dtype=np.int64, sep=" ")