let n = read_int ()

let arr = Array.make 100001 0

let rec f i odd even =
  if i = n then (odd, even)
  else
    let j = Scanf.scanf " %d" (fun a -> a) in
    if 0 = arr.(j) then (ignore (arr.(j) <- 1); f (i+1) (odd + 1) even)
    else if 1 = arr.(j) then (ignore (arr.(j) <- 2); f (i + 1) (odd - 1) (even + 1))
    else (ignore (arr.(j) <- 1); f (i + 1) (odd + 1) (even - 1))
    
let odd, even = f 0 0 0

let () = print_int (odd + even / 2 * 2)