n = int(eval(input()))

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



mod = 10**9 + 7

ans = 0

two = 1

for i in range(61):

    one = 0

    for j in range(n):

        if (a[j] >> i) & 1:

            one += 1

    ans = (ans + (one*(n-one))*two) % mod

    two = (two * 2) % mod

print(ans)
import numpy as np



n = int(eval(input()))

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



mod = 10**9 + 7

ans = 0

two = 1

for i in range(61):

    one = np.count_nonzero(a & 1)

    a = a >> 1

    ans = (ans + (one*(n-one))*two) % mod

    two = (two * 2) % mod

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
two = 1
for i in range(61):
    one = 0
    for j in range(n):
        if (a[j] >> i) & 1:
            one += 1
    ans = (ans + (one * (n - one)) * two) % mod
    two = (two * 2) % mod
print(ans)

import numpy as np

n = int(eval(input()))
a = np.array(list((list(map(int, input().split())))))
mod = 10**9 + 7
ans = 0
two = 1
for i in range(61):
    one = np.count_nonzero(a & 1)
    a = a >> 1
    ans = (ans + (one * (n - one)) * two) % mod
    two = (two * 2) % mod
print(ans)

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