let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let rec f n = if n <= 0 then 1 else 3 * f (n - 1)
let _ = f n - Array.fold_left (fun c a -> c * if a mod 2 = 0 then 2 else 1) 1 a_s |> Printf.printf "%d\n"