{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.Char
import Data.List

solve :: VUM.IOVector Int -> Int -> IO Bool
solve vec i = do
    right <- VUM.read vec i
    left <- VUM.read vec (i-1)

    case compare left right of
        LT -> return True
        EQ -> return True
        GT ->
            if (left == (right + 1))
                then do
                    VUM.modify vec (\x -> x-1) (i-1)
                    return True
                else
                    return False
    
main = do
    n <- readLn :: IO Int
    xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    (xs' :: VUM.IOVector Int) <- VU.unsafeThaw xs
    res <- and <$> sequence [solve xs' i | i <- [n-1,n-2..1]]
    putStrLn $ if res then "Yes" else "No"