{-# LANGUAGE BangPatterns #-}
import Data.Vector.Unboxed as VU
import Data.ByteString.Char8 as BS
import Data.Char (isSpace)
import Control.Applicative ((<$>)

main :: IO ()
main = do
  n <- readLn
  hs <- VU.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  putStrLn
   $ if VU.foldr
         (\ !h cont !left ->
             case compare left h of
               GT -> False
               EQ -> cont h
               LT -> cont $! h-1)
         (\ !left -> True)
         hs 0
     then "Yes" else "No"