#include using namespace std; typedef long long ll; const int MOD = 998244353; ll dp[200010][2][3][3]; int main() { int N; cin >> N; vectorA(N); for(int i = 0; i < N; i++) cin >> A[i]; dp[0][0][0][0] = 1; for(int i = 0; i < N; i++){ int neg = A[i] < 0 ? 1 : 0; int two = A[i] == 0 ? 2 : (abs(A[i]) == 2 ? 1 : 0); for(int j = 0; j < 2; j++){ for(int k = 0; k < 3; k++){ if(i == 0) (dp[i + 1][j][k][0] += dp[i][j][k][0]) %= MOD; else (dp[i + 1][j][k][0] += 2 * dp[i][j][k][0]) %= MOD; (dp[i + 1][(j + neg) % 2][min(2, k+two)][1] += dp[i][j][k][0] + dp[i][j][k][1]) %= MOD; (dp[i + 1][(j + neg) % 2][min(2, k+two)][2] += dp[i][j][k][0] + dp[i][j][k][1]) %= MOD; if(i == N - 1) (dp[i + 1][j][k][2] += dp[i][j][k][2]) %= MOD; else (dp[i + 1][j][k][2] += 2 * dp[i][j][k][2]) %= MOD; } } } ll ans = dp[N][1][1][2]; for(int i = 0; i < N - 1; i++)(ans *= 499122177) %= MOD; cout << ans << endl; return 0; }