import Control.Arrow
import Control.Monad
import Data.List
main = readLn >>= main'
    where
        main' n = getLine >>= print . solve n . map length . group . sort . map (read :: String -> Int) . words

solve :: Int -> [Int] -> Int
solve n xs
    | odd m = s - 1
    | otherwise = s
    where
        (s, m) = foldl' (\(acc, d) x -> (acc + 1, d + x - 1)) (0, 0) xs
