{-# LANGUAGE BangPatterns #-}

import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List (unfoldr)
import Control.Monad
import qualified Data.Vector.Unboxed as UV

main = do
    n <- UV.head . UV.unfoldr BS.readInt <$> BS.getLine
    ls <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    let !noStep = all (\x -> x) $ zipWith (\x y -> x - y < 2) ls (tail ls)
    let !notOftenStep = zipWith (\x y -> x > y) ls (tail ls)
    let f = any (\x -> x) $ zipWith (&&) notOftenStep (tail notOftenStep)
    putStrLn $ if noStep && f then "No" else "Yes"
