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

solve (l, h)
  | l > h = l - h
  | l < h = l
  | otherwise = 0

main = do
  n <- read <$> getLine :: IO Int
  a <- words <$> getLine :: IO [String]
  let xs = group . sort $ fmap (read :: String -> Int) a
      ls = fmap length xs
      hs = fmap head xs
      zs = zip ls hs
  putStrLn . show . sum $ fmap solve zs
