main :: IO()
main = do
    _ <- getLine
    p <- map read . words <$> getLine :: IO [Int]
    let m = scanl min 364364 p
        w = zip p m
        ans = sum $ map (\(a, b) -> if a < b then 1 else 0) w
    print ans