import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Debug.Trace
import Data.List

getEachNumberCount :: [Int] -> [Int]
getEachNumberCount = map length . group . sort

countDuplicated :: [Int] -> Int
countDuplicated [] = 0
countDuplicated (x:xs) = (x - 1) + (countDuplicated xs)

solve:: [Int] -> Int
solve arr = ans
    where
        countArr = getEachNumberCount arr
        dup = countDuplicated countArr
        cardNum = length countArr
        ans = if dup `mod` 2 == 0 then cardNum else cardNum - 1

main :: IO ()
main = do
    n <- (fst . fromJust . BS.readInt) <$> BS.getLine
    a <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    print $ solve a
