import Data.List

main :: IO ()
main = do
  n <- readLn
  as' <- sort . map read . words <$> getLine
  let
    as = map (pred.length) $ group (as' :: [Int])
    s = sum as
  case () of
    _ | s > 2 -> print $ n - (s+1)`div`2*2
      | s == 0 -> print n
      | otherwise -> print $ n-2