let n = Scanf.scanf " %d" (+) 0
let hs = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let p = ref @@ hs.(0) - 1
let _ = for i = 1 to n - 1 do if !p > hs.(i) then (print_endline "No"; exit 0); p := hs.(i) - if !p < hs.(i) then 1 else 0 done; print_endline "Yes"