N = gets.chomp.to_i
color = []
N.times do |i|
    a = gets.chomp.to_i
    overwrite = color.find_index{|aa, ii| aa < a && ii < i}
    if overwrite
        color[overwrite] = [a, i]
    else
        color = [[a, i]] + color
    end
end
puts color.length