def combmod2(n, r): #comb(n, r)は偶数か? True/False x = format(n, '032b') y = format(r, '032b') for i in range(32): if x[i] == '0' and y[i] == '1': return True return False def solve(n, a): dp = [[0] * 2 for _ in range(n + 1)] dp[0][0] = 1 mod = 998244353 for i in range(n): if a[i] != -1: if combmod2(n, i): dp[i + 1][1] += dp[i][1] dp[i + 1][0] += dp[i][0] else: dp[i + 1][(1 + a[i]) % 2] += dp[i][1] dp[i + 1][a[i]] += dp[i][0] else: if combmod2(n, i): dp[i + 1][1] += dp[i][1] dp[i + 1][0] += dp[i][0] else: dp[i + 1][1] += dp[i][0] + dp[i][1] dp[i + 1][0] += dp[i][0] + dp[i][1] dp[i + 1][1] %= mod dp[i + 1][0] %= mod return dp[n][1] n = int(input()) a = list(map(int,input().split())) if 2 <= n <= 2 * 10 ** 5 and a.count(-1) + a.count(0) + a.count(1) == n: pass else: raise Exception print(solve(n, a))