import Data.List
main :: IO()
main = do
  _ <- getLine
  a <- map read . words <$> getLine
  print $ slv a [1..10000] 0

slv :: [Integer] -> [Integer] -> Integer -> Integer
slv s ptn ret = slv2 (sort s) ptn ret

slv2 :: [Integer] -> [Integer] -> Integer -> Integer
slv2 s (p:ps) ret | length arc == length abc = slv2 s ps (ret+1)
                  | otherwise = slv2 s ps ret
  where (arc, abc) = span (<p) s
slv2 _ _ ret = ret