const MOD = 10^9+7

function solve()
    N = parse(Int,readline())
    A = parse.(Int,split(readline()))
    ans = 0
    for i in 0:60
        cnt1 = 0
        for j in 1:N
            (A[j]>>i&1==1) && (cnt1+=1)
        end
        ans += mod((N-cnt1)cnt1 * 1<<i, MOD)
        ans %= MOD;
    end
    println(ans)
end
solve()