import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

x ? (a,b) = if x then a else b

main = do
 getLine
 inputs <- readLnInt
 putStr $ solve inputs

solve s = (check 0 s)?("Yes","No")

check _ [] = True
check _ [a] = True
check 1 (a:as)
 | a-1 == head as = check 2 as
 | otherwise = False
check 3 s@(a:as)
 | alltaller s = check 2 as
 | otherwise = False
check n s@(a:as)
 | a>head as = check (n+1) s
 | otherwise = check n as

alltaller (a:as) = (a-1>head as)?(False,(null as)?(True,alltaller as))
