{-# LANGUAGE TypeApplications #-}

import           Control.Monad
import           Control.Applicative
import           Data.List
import           Data.Char
import           Control.Arrow
import           Data.Bits


main = do
  n <- readLn @Int
  h <- map (read @Int) . words <$> getLine
  print $ solve h 0 0
 where
  solve [_] k m = m
  solve (a : b : rs) k m | a >= b    = solve (b : rs) (k + 1) (max (k + 1) m)
                         | otherwise = solve (b : rs) 0 m
