import Data.List( sortBy, sort, group)
main = do
    getLine
    as_ <- return . map (read::String->Int) . words =<< getLine
    let
	gs = group . sort $ as_
	counts = map length gs
	countSorted = sortBy (flip compare) counts
	proc []			= 0
	proc [_]		= 1
	proc list@(1:_)		= length list
	proc (n1:tl@(n2:ns))
	  | 2<n1		= let
		    a = proc ((n1-2):tl)
		    b = if n2==1
			    then 0
			    else proc ((n1-1):(n2-1):ns)
		in max a b
	  | 2==n1		= if n2==1
				    then proc tl
				    else 1 + proc ((n2-1):ns)
	  | otherwise		= 1 + proc ns
    print $ proc countSorted
