import Main where

import           Control.Applicative
import           Data.List

main :: IO ()
main = do
    n   <- readLn
    p_i <- map read . words <$> getLine
    putStrLn $ show $ solve3 n p_i


solve3 :: Int -> [Int] -> Int
solve3 n p_i = leftBiggerThanRight p_i 200000
  where
    leftBiggerThanRight :: [Int] -> Int -> Int
    leftBiggerThanRight [] mini = 0
    leftBiggerThanRight (x : xs) mini
        | x <= mini = 1 + (leftBiggerThanRight xs x)
        | x > mini  = 0 + (leftBiggerThanRight xs mini)