main = do
    getLine
    ls <- map read . words <$> getLine
    putStrLn $ if getsolve $ reverse ls then "Yes" else "No"
    
    
    
    
    
getsolve :: [Int] -> Bool
getsolve ls
    | length ls == 1            = True
    | last ls == semilast       = getsolve $ tail ls
    | last ls + 1 == semilast   = getsolve $ (tail $ tail ls) ++ [semilast - 1]
    | otherwise                 = False
    where semilast = last $ init ls