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

(1..N-1).each do |i|
  if 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
end

puts colors.size