main :: IO()
main = do
  _ <- getLine
  h <- map read . words <$> getLine
  print $ slv h True

slv :: [Integer] -> Bool -> String
slv (h:hh:hs) s | hh - h > 0 = slv (hh:hs) True
                | hh - h == 0 = slv (hh:hs) s
                | s == False = "No"
                | otherwise = slv (hh:hs) False
slv (h:hs) s = "Yes"
