import Data.List

main::IO()
main = do
    n <- readLn::IO Int
    xs <- map read . words <$> getLine::IO [Int] 
    print $ (query . group . sort) xs


query::[[Int]] -> Int
query[] = 0
query (x:xs) = if x!!0 == length x then 0 + query xs else addOrSub x + query xs  

addOrSub::[Int] -> Int
addOrSub x = case length x <= abs(x!!0 - (length x)) of
                 True -> length x
                 False -> abs((x!!0) - (length x))

