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