n = gets.chomp.to_i
a_arr = n.times.map{gets.to_i}

color = [-1]
a_arr.each do |a|
  if a <= color[-1] then
    color << (a)
    next
  end
  color.each_with_index do |c, i|
    if a > c then
      color.delete_at(i)
      color.unshift(a)
      break
    end
  end
end

puts color.length
