let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let rec f i b =
  if i >= n then if b then 1 else 0
  else let ft, fb = f (i + 1) true, f (i + 1) b in if a_s.(i) mod 2 = 0 then ft + 2 * fb else fb + 2 * ft
let _ = Printf.printf "%d\n" @@ f 0 false