#include using namespace std; using ll = long long; const ll MOD = 998244353; using P = pair; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() const int MAX_N = 200200; vector fac(MAX_N), finv(MAX_N), inv(MAX_N); void mcomin(){ fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for(int i=2;i> n; vector b(n); rep(i,n) cin >> b[i]; ll even = 0, num1 = 0, num0 = 0, p = n, q = 0, k = 0; rep(i,n){ if(q){ ll pp = p, qq = q; while(!(pp%2)){ pp /= 2; even++; } while(!(qq%2)){ qq /= 2; even--; } } if(b[i] == -1){ if(even) num0++; else num1++; }else if(b[i] == 1 && !even) k = k^1; p--; q++; } ll ans = 0; for(ll i=(k==0);i<=num1;i+=2){ ans += mcomb(num1,i); } ans %= MOD; ans = ans * mpow(2,num0) % MOD; cout << ans << endl; return 0; }