N = int(input())
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7

lst = [0] * 65
for a in A:
    tmp = a
    for i in range(61):
        lst[i] += tmp % 2
        tmp //= 2
        if tmp == 0:
            break

calc = [1]
for i in range(65):
    calc.append(calc[-1] * 2)

ans = 0
for a in A:
    tmp = a
    for i in range(61):
        n = tmp % 2
        tmp //= 2
        if n == 1:
            ans += calc[i] * (N - lst[i])
        else:
            ans += calc[i] * lst[i]
    ans %= MOD

def modinv(a, m): #mod m でのaの逆元 a^{-1}を計算する
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    
    u %= m
    if u < 0:
        u += m
    return u

# print (ans)
ans *= modinv(2, MOD)
print (ans % MOD)