import sys input = sys.stdin.readline N=int(input()) C=list(map(int,input().split())) mod=998244353 MAX=max(C) MIN=min(C) if MIN>=0: ANS=1 for c in C: if c!=MAX: ANS=ANS*2%mod print(ANS) elif MAX<=0: ANS=1 for c in C: if c!=MIN: ANS=ANS*2%mod print(ANS) else: ANS=2 for c in C: if c==0: ANS=ANS*3%mod elif c!=MIN and c!=MAX: ANS=ANS*2%mod print(ANS)