import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int N = sc.nextInt(); int[] B = new int[N]; for (int i = 0;i < N;++ i) B[i] = sc.nextInt(); final int MOD = 998_244_353; int use = -1, ans = 1, sum = 0; for (int i = 0;i < N;++ i) { if (B[i] == -1) { if (combination_mod2(N - 1, i) == 0) ans = ans * 2 % MOD; else ++ use; } else if (combination_mod2(N, i) != 0) sum = sum + B[i] & 1; } if (use < 0 && sum == 0) System.out.println(0); else { while(use --> 0) ans = ans * 2 % MOD; System.out.println(ans); } } } static int combination_mod2(int n, int k) { return (n & k) == k ? 1 : 0; } }