import Control.Monad
import Data.List

main = do
    n <- read <$> getLine
    a <- map read <$> replicateM n getLine
    print $ length $ foldl' sub5 [] a

sub5 :: [Int] -> Int -> [Int]
sub5 ls n = if   null f
            then n:ls
            else n:delete (maximum f) ls
    where f = filter (<n) ls