import Data.Bits
import Data.List
import Control.Monad
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B
--import Debug.Trace


main :: IO ()
main = do
  n <- readLn ::IO Int
  hs <- map read.words <$> getLine :: IO [Int]
  --traceShowM (hs, scanr1 min hs)
  putStrLn $ if [] == (filter (> 1) $ zipWith (-) hs (scanr1 min hs)) then "Yes" else "No"
