words = lambda t : list(map(t, input().split()))

n = int(eval(input()))

xs = words(int)



ys = [0]*60

for x in xs:

    for i in range(60):

        if x == 0:

            continue

        ys[i] += x & 1

        x = x >> 1



ans = 0



for i,yi in enumerate(ys):

    ans += 2**(i) * yi * (n-yi)

    ans %= 10**9 + 7

print(ans)

from functools import reduce



words = lambda t : list(map(t, input().split()))

n = int(eval(input()))

xs = words(int)



def func(y, x):

    for i in range(60):

        if x == 0:

            continue

        y[i] += x & 1

        x = x >> 1

    return y



ys = reduce(func, xs, [0]*60)

ans = 0



for i,yi in enumerate(ys):

    ans += 2**(i) * yi * (n-yi)

    ans %= 10**9 + 7

print(ans)

words = lambda t: list(map(t, input().split()))
n = int(eval(input()))
xs = words(int)
ys = [0] * 60
for x in xs:
    for i in range(60):
        if x == 0:
            continue
        ys[i] += x & 1
        x = x >> 1
ans = 0
for i, yi in enumerate(ys):
    ans += 2 ** (i) * yi * (n - yi)
    ans %= 10**9 + 7
print(ans)

from functools import reduce

words = lambda t: list(map(t, input().split()))
n = int(eval(input()))
xs = words(int)


def func(y, x):
    for i in range(60):
        if x == 0:
            continue
        y[i] += x & 1
        x = x >> 1
    return y


ys = reduce(func, xs, [0] * 60)
ans = 0
for i, yi in enumerate(ys):
    ans += 2 ** (i) * yi * (n - yi)
    ans %= 10**9 + 7
print(ans)

+from functools import reduce + -ys = [0] * 60 -for x in xs: + + +def func(y, x): -        ys[i] += x & 1 +        y[i] += x & 1 +    return y + + +ys = reduce(func, xs, [0] * 60)