N = gets.to_i
A = (1..N).map { |_| gets.to_i }
  
colors = [ [0, A[0]] ]

(1..N-1).each do |i|
  next unless A[i] > A[i - 1]
  c_idx = colors.index { |c| c[1] < A[i] }
  if c_idx
    colors[c_idx] = [i, A[i]]
  else
    colors << [i, A[i]]
  end
end

puts colors.size