import Data.Array.IO
import Data.IORef
import Data.Array
main::IO()
main = do
  _<-getLine
  dc<-getLine
  let dat =map read (words dc)::[Int]
  ar<-newArray (1,100000) 0
  ar_pt<- newIORef ar
  make_histgram ar_pt dat
  i_ar<-freeze ar
  let hist_ls = elems i_ar
  print (solver hist_ls)

make_histgram::IORef (IOArray Int Int) -> [Int] -> IO()
make_histgram ar_pt [] = return ()
make_histgram ar_pt (x:xs) = do
                          ar<- readIORef ar_pt
                          v<-readArray ar x
                          writeArray ar x (v+1)
                          make_histgram ar_pt xs

solver::[Int]->Int
solver ls = let non_zero = filter (\x-> x/=0) ls in
            let ev_length = length (filter (\x-> mod x 2 ==0 ) non_zero) in
            let od_length = length (filter (\x-> mod x 2 /=0 ) non_zero) in
            od_length+ev_length+ (if mod ev_length 2 == 0 then 0 else (-1))