(* O(n) *)
let n = Scanf.scanf " %d" @@ (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let f (acc, a0, inc) a =
  if (if a0 = a then true
  else if a0 < a then inc >= 0
  else inc <= 0) then acc, a, a - a0 else acc + 1, a, 0
let c, _, _ = Array.fold_left f (0, 0, 0) a_s
let _ = Printf.printf "%d\n" @@ c + 1