let () = Scanf.scanf "%d\n" @@ fun n ->
  let hs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun h -> h in
  print_endline @@
  match
    Array.fold_right (fun h (b, h') ->
      if h <= h'
      then (b, h)
      else (b && h - 1 <= h', h - 1)) hs (true, max_int)
  with
  | (true, _) -> "Yes"
  | (false, _) -> "No"

