import numpy as np

N = int(input())
A = tuple(map(int, input().split(' ')))
MOD = 10 ** 9 + 7


def format2binary(n):
    return list(reversed(format(n, '060b')))


binaries = np.array(list(map(format2binary, A)))

zeros = np.sum((binaries == '0'), axis=0)
ones = np.sum((binaries == '1'), axis=0)

base = 1
ans = 0

for i in range(len(zeros)):
    ans += zeros[i] * ones[i] * base
    ans %= MOD
    base *= 2
    base %= MOD

print(ans)
