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 if a_s.(i) mod 2 = 0 then f (i + 1) true + f (i + 1) b + f (i + 1) b
  else f (i + 1) b + f (i + 1) true + f (i + 1) true
let _ = Printf.printf "%d\n" @@ f 0 false