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

bits = [0] * 60
for d in a:
    for i in range(60):
        if d % 2 == 1:
            bits[i] += 1
        d >>= 1
        if d == 0:
            break

total = 0
mod = 10 ** 9 + 7
for i in range(60):
    total += (2 ** i) * (bits[i] * (n - bits[i]))
    total %= mod
print(total)
