import Control.Applicative ((<$>))
import Data.List (sort, group)

solve :: [[Int]] -> Int
solve [] = 0
solve (xs:xxs)
  | length xs > head xs = length xs - head xs + solve xxs
  | length xs < head xs = length xs + solve xxs
  | length xs == head xs = solve xxs

main = do
  n <- read <$> getLine :: IO Int
  a <- words <$> getLine :: IO [String]
  putStrLn . show . solve . group . sort $ fmap (read :: String -> Int) a
