#include using namespace std; constexpr int mod = 998244353; int dp[200001][2]; int main() { int N; cin >> N; dp[0][0] = 1; for(int i = 0; i < N; i++) { int B; cin >> B; for(int j = 0; j < 2; j++) { if(B == 0 || B == -1) { dp[i+1][j] += dp[i][j]; dp[i+1][j] %= mod; } if(B == 1 || B == -1) { dp[i+1][(j+N-min(i+1,N-i))%2] += dp[i][j]; dp[i+1][(j+N-min(i+1,N-i))%2] %= mod; } } } cout << dp[N][1] << endl; }