def mod_pow(a, n):

    res = 1

    while n > 0:

        if n & 1:

            res = res * a % mod

        a = a * a % mod

        n >>= 1

    return res





n = int(eval(input()))

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



mod = 10 ** 9 + 7



cnt = [0] * 60

for v in a:

    for i in range(60):

        if (v >> i) & 1:

            cnt[i] += 1



pow_2 = [1]

for i in range(60):

    pow_2.append(pow_2[-1] * 2 % mod)



res = 0

for v in a:

    for i in range(60):

        if (v >> i) & 1:

            res = (res + (n - cnt[i]) * pow_2[i] % mod) % mod

        else:

            res = (res + cnt[i] * pow_2[i] % mod) % mod



print((res * mod_pow(2, mod - 2) % mod))
n = int(eval(input()))

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



mod = 10 ** 9 + 7



res = 0

two_factor = 1

for i in range(60):

    cnt_1 = 0

    cnt_0 = 0

    for v in a:

        if (v >> i) & 1:

            cnt_1 += 1

        else:

            cnt_0 += 1

    res = (res + cnt_1 * cnt_0 % mod * two_factor % mod) % mod

    two_factor = two_factor * 2 % mod



print(res)
def mod_pow(a, n):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res


n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
cnt = [0] * 60
for v in a:
    for i in range(60):
        if (v >> i) & 1:
            cnt[i] += 1
pow_2 = [1]
for i in range(60):
    pow_2.append(pow_2[-1] * 2 % mod)
res = 0
for v in a:
    for i in range(60):
        if (v >> i) & 1:
            res = (res + (n - cnt[i]) * pow_2[i] % mod) % mod
        else:
            res = (res + cnt[i] * pow_2[i] % mod) % mod
print((res * mod_pow(2, mod - 2) % mod))

n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
res = 0
two_factor = 1
for i in range(60):
    cnt_1 = 0
    cnt_0 = 0
    for v in a:
        if (v >> i) & 1:
            cnt_1 += 1
        else:
            cnt_0 += 1
    res = (res + cnt_1 * cnt_0 % mod * two_factor % mod) % mod
    two_factor = two_factor * 2 % mod
print(res)

-def mod_pow(a, n): -    res = 1 -    while n > 0: -        if n & 1: -            res = res * a % mod -        a = a * a % mod -        n >>= 1 -    return res - - -cnt = [0] * 60 -for v in a: -    for i in range(60): +res = 0 +two_factor = 1 +for i in range(60): +    cnt_1 = 0 +    cnt_0 = 0 +    for v in a: -            cnt[i] += 1 -pow_2 = [1] -for i in range(60): -    pow_2.append(pow_2[-1] * 2 % mod) -res = 0 -for v in a: -    for i in range(60): -        if (v >> i) & 1: -            res = (res + (n - cnt[i]) * pow_2[i] % mod) % mod +            cnt_1 += 1 -            res = (res + cnt[i] * pow_2[i] % mod) % mod -print((res * mod_pow(2, mod - 2) % mod)) +            cnt_0 += 1 +    res = (res + cnt_1 * cnt_0 % mod * two_factor % mod) % mod +    two_factor = two_factor * 2 % mod +print(res)