let rec solution h i m =
    if i == Array.length h then "Yes"
    else if h.(i) < m then "No"
    else solution h (i+1) @@ max (h.(i)-1) m;;

Printf.printf "%s\n" @@
Scanf.scanf "%d\n" @@ fun n ->
    let h = Array.init n @@ fun _ -> Scanf.scanf "%d " ( + ) 0 in
    solution h 0 0;;

