n = gets.to_i
a = gets.split.map(&:to_i)
c = Array.new(60, 0)
a.each do |aa|
    i = 0
    while aa > 0
        if aa % 2 == 1
            c[i] += 1
        end
        aa /= 2
        i += 1
    end
end
ans = 0
k = 1
c.each do |cc|
    ans += (cc * (n - cc) * k)
    ans %=  (10 ** 9 + 7)
    k *= 2
end
puts ans