parseline(str=readline()) = parse.(Int, split(str))
function XorSum4()
    N = parse(Int, readline())
    A = parseline()
    Mod = 10^9+7
    ans = 0
    for i in 1:N-1
        for j in i+1:N
            ans += mod(A[i]⊻A[j], Mod)
        end
    end
    println(mod(ans, Mod))
end
XorSum4()