n = int(eval(input()))

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



wa = 0

kazu = 10**9 + 7

for i in range(60):

    b = 0

    for j in a:

        b += j & 1

    wa = (wa + b*(n-b)*(1<<i)) % kazu

    for j in range(n):

        a[j] = a[j] >> 1



print(wa)
import numpy as np



n = int(eval(input()))

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



wa = 0

kazu = 10**9 + 7

for i in range(60):

    b = int((a & 1).sum())

    wa = (wa + b*(n-b)*(1<<i)) % kazu

    a = a >> 1



print(wa)
n = int(eval(input()))
a = list(map(int, input().split()))
wa = 0
kazu = 10**9 + 7
for i in range(60):
    b = 0
    for j in a:
        b += j & 1
    wa = (wa + b * (n - b) * (1 << i)) % kazu
    for j in range(n):
        a[j] = a[j] >> 1
print(wa)

import numpy as np

n = int(eval(input()))
a = np.array(list(map(int, input().split())))
wa = 0
kazu = 10**9 + 7
for i in range(60):
    b = int((a & 1).sum())
    wa = (wa + b * (n - b) * (1 << i)) % kazu
    a = a >> 1
print(wa)

+import numpy as np + -a = list(map(int, input().split())) +a = np.array(list(map(int, input().split()))) -    b = 0 -    for j in a: -        b += j & 1 +    b = int((a & 1).sum()) -    for j in range(n): -        a[j] = a[j] >> 1 +    a = a >> 1