while true
  n = gets.to_i
  break if n == 0
  as = []
  n.times do 
    as.push(gets.to_i)
  end
  length = 1
  top = -1
  as.each do |a|
    if length == 1
      old_top = top
      top = a
      next if old_top < 0 || old_top >= a
      length += 1
      next
    end
    if top < a
      length += 1
      top = a
      next
    end
  end
  puts length
end