N = gets.to_i
as = gets.split.map(&:to_i)
ans = 0
61.times do |i|
    cnt = 0
    N.times do |j|
        cnt += 1 if as[j][i] == 1 
    end
    ans += (cnt)*(N-cnt)*(1<<i)
    ans %= 1000000007
end
puts ans
