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 0 (a:as)
 | all (a<=) as = check 0 as
 | all (a-1<=) as = check 1 as
 | otherwise = False
check 1 (a:as)
 | all (a<=) as = check 1 as
 | otherwise = False
