
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Data.List
import Control.Monad
import Data.Foldable
import Data.Char
import qualified Data.IntMap.Strict as IM
import qualified Data.IntSet as IS

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


main :: IO ()
main = do
    _ <- readLn :: IO Int
    as <- map (pred.snd) . IM.toList . IM.fromListWith (+) . (flip zip) (repeat 1) <$> r'
    let n = length as
    print $ if odd (sum as) then n-1 else n
