mod = 998244353 n = int(input()) c = list(map(int, input().split())) if n == 1: print(1) exit() if c[-1] < 0: c = [-x for x in reversed(c)] if c[0] >= 0: print(pow(2, n - 1, mod)) elif 0 in c: print(2 * pow(2, n - 3, mod) * 3 % mod) else: print(2 * pow(2, n - 2, mod))