(* 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 =
  let b, i = if a0 = a then true, inc
    else if a0 < a then inc >= 0, if inc = 0 then 1 else inc
    else inc <= 0, if inc = 0 then -1 else inc in
  if b then acc, a, i else acc + 1, a, 0
let c, _, _ = Array.fold_left f (0, a_s.(0), 0) a_s
let _ = Printf.printf "%d\n" @@ c + 1