main = do 
    _ <- getLine
    arr <- map (read :: String -> Int). words <$> getLine
    print $ if (solve 0 arr True) then "Yes" else "No"
    where
        solve p [] True = True
        solve p [] False = True
        solve p (x:xs) False = 
            if x < p
            then
                False
            else
                solve x xs False
        solve p (x:xs) True = 
            if x < (p - 1)
            then
                False
            else
                solve x xs (p <= x)





