N = int(eval(input()))

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



p = int(1e9+7)

res = 0



for i in range(60):

    zc = 0

    oc = 0

    for j in range(len(A)):

        if A[j] % 2 == 0:

            zc += 1

        else:

            oc += 1

        A[j] = A[j] >> 1



    res += zc*oc*2**i

    res %= p



print(res)
import numpy as np



N = int(eval(input()))

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



p = int(1e9+7)

res = 0



for i in range(60):

    zc = np.count_nonzero(A & 1)

    oc = N - zc



    res += zc*oc*2**i

    res %= p

    A >>= 1



print(res)
N = int(eval(input()))
A = list(map(int, input().split()))
p = int(1e9 + 7)
res = 0
for i in range(60):
    zc = 0
    oc = 0
    for j in range(len(A)):
        if A[j] % 2 == 0:
            zc += 1
        else:
            oc += 1
        A[j] = A[j] >> 1
    res += zc * oc * 2**i
    res %= p
print(res)

import numpy as np

N = int(eval(input()))
A = np.array(list(map(int, input().split())))
p = int(1e9 + 7)
res = 0
for i in range(60):
    zc = np.count_nonzero(A & 1)
    oc = N - zc
    res += zc * oc * 2**i
    res %= p
    A >>= 1
print(res)

+import numpy as np + -A = list(map(int, input().split())) +A = np.array(list(map(int, input().split()))) -    zc = 0 -    oc = 0 -    for j in range(len(A)): -        if A[j] % 2 == 0: -            zc += 1 -        else: -            oc += 1 -        A[j] = A[j] >> 1 +    zc = np.count_nonzero(A & 1) +    oc = N - zc +    A >>= 1