n = gets.to_i
input = []
n.times do
    input.push(gets.to_i)
end

colors = []
input.each.with_index do |val, index|
    if index == 0
        colors.push(val)
    else
        if val <= colors[-1]
            colors.push(val)
        else
            colors.each.with_index do |r, i|
                if r < val
                    colors[i] = val
                    colors = colors.sort.reverse
                    break
                end
            end
        end
    end
end
puts colors.size