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 [n]
	  | even n		= 0
	  | otherwise		= 1
	proc (1:ns)		= 1 + length ns
	proc (2:tl@(1:ns))	= proc tl
	proc (2:2:ns)		= 2 + proc ns
	proc (2:n:ns)		= 1 + proc ((n-1):ns)
	proc (n:ns)
	  | even n		= proc (2:ns)
	  | otherwise		= 1 + proc ns
    print $ proc countSorted