import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = getLine >> readLine >>= print . solve

solve :: [Int] -> Int
solve = check 0 0 
    where
        check acc p (x : xs)
            | p <= x = check (acc + 1) x xs
            | otherwise = check acc p xs
        check acc _ _ = acc

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine