main = do
  li <- getLine
  li <- getLine
  let hs = map read $ words li
  let ans = compute hs
  putStrLn $ if ans then "Yes" else "No"

compute :: [Int] -> Bool
compute hs = loop True hs

-- b は「h1は1下げられる」フラグ
loop _ [_] = True
loop b (h1:h2:hs)
  | h1 < h2 = loop True (h2:hs)
  | h1 == h2 = loop b (h2:hs)
  | h1 - 1 == h2 = b && loop False (h2:hs)
  | otherwise = False