import sys input = sys.stdin.readline MOD=998244353 def main(): N=int(input()) A=list(map(int,input().split())) dp=[[[0 for _ in range(3)] for _ in range(3)] for _ in range(2)] dp2=[[[0 for _ in range(3)] for _ in range(3)] for _ in range(2)] dp[0][0][0]=1 for i in range(N): neg=(1 if A[i]<0 else 0) two=(2 if A[i]==0 else (1 if abs(A[i])==2 else 0)) for j in range(2): for k in range(3): if i==0: dp2[j][k][0]+=dp[j][k][0] else: dp2[j][k][0]+=2*dp[j][k][0] dp2[(j+neg)%2][min(2,k+two)][1]+=dp[j][k][1]+dp[j][k][0] dp2[(j+neg)%2][min(2,k+two)][2]+=dp[j][k][1]+dp[j][k][0] if i==N-1: dp2[j][k][2]+=dp[j][k][2] else: dp2[j][k][2]+=2*dp[j][k][2] for j in range(2): for k in range(3): for l in range(3): dp[j][k][l]=dp2[j][k][l]%MOD dp2[j][k][l]=0 ans=dp[1][1][2] print((ans*pow(pow(2,N-1,MOD),MOD-2,MOD))%MOD) if __name__=='__main__': main()