main = do
  _ <- getLine
  hs <- map read . words <$> getLine
  print $ length (f hs [])

f :: [Int] -> [Int] -> [Int]
f xs ans
  | length xs == 1 = ans ++ xs
  | maximum (init xs) <= last xs = f (init xs) (ans ++ [last xs])
  | otherwise = f (init xs) ans
