Scanf.scanf "%d %d" (fun n p ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i p0 p1 =
        if i = n then (if p = 0 then p0 else p1) else
            if a.(i) mod 2 = 0 then loop (i + 1) (p0 * 2) (p1 * 2) else
                                    loop (i + 1) (p0 + p1) (p0 + p1)
    in
    loop 0 1 0 |> Printf.printf "%d\n"
)