solve :: [Int] -> Int -> Int 
solve [] m = 0
solve (x:xs) m
    | x <= m = 1 + solve xs (min m x)
    | otherwise =  solve xs (min m x)
    
main = do
    n <- readLn :: IO Int
    xs <- map read . words <$> getLine :: IO [Int]
    print $ solve xs (head xs)