import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    getLine
    hs <- getIntList
    putStrLn $ solve hs

solve (h : []) = "Yes"
solve (h1 : h2 : []) | h2 >= h1 = "Yes"
                     | otherwise = "No"
solve (h1 : h2 : hs) | h1 == h2 = solve (h2 : hs)
                     | h2 > h1 = solve ((h2 - 1) : hs)
                     | otherwise = "No"