Scanf.scanf "%d" @@ fun n ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  Array.fold_left (fun (z, (y, s)) x ->
    if s = 0 then if x = y then z, (x, 0) else z, (x, (x-y))
    else if s * (x-y) < 0 then z+1, (x, 0) else z, (x, s)) (1, (a.(0), 0)) a
  |> fst |> Printf.printf "%d\n"