main :: IO()
main = do
    n <- getLine
    ls <- map read . words <$> getLine
    print $ solve ls

solve :: [Int] -> Int
solve ls 
    | ls == []							= 0
    | canShow (last ls) (init ls)		= 1 + (solve $ init ls)
    | otherwise							= solve $ init ls

canShow :: Int -> [Int] -> Bool
canShow myBld otherBld
    | otherBld == []			= True
    | myBld >= head otherBld	= canShow myBld (tail otherBld)
    | otherwise					= False