N = int(input())

A = map(int, input().strip().split())

# A[i] = 2^60 * a60 + ... + 2^0*a0
# A[i] XOR A[j]
# a60==1 -> P
# a60 == 0 -> Q
# 2^60 * (P * Q)

P = [0 for _ in range(0, 61)]

for a in A:
    ba = bin(a)
    ba = ba[2:][::-1]
    for i in range(0, 61):
        if i < len(ba):
            if ba[i] == '1':
                P[i] += 1

mod = int(1e9) + 7
total = 0
base = 1

for i in range(0, 61):
    total += ((P[i] * (N - P[i]) * base) % mod)
    total %= mod
    base = base * 2
    base %= mod

print(total)
