N = int(input()) A = list(map(int,input().split())) mod = 998244353 dic1 = {0:1} dic2 = {} for i in range(N): for k,v in dic1.items(): t = k + A[i] if t in dic2: dic2[t] = (dic2[t] + v) % mod else: dic2[t] = v t = k - A[i] if t in dic2: dic2[t] = (dic2[t] + v) % mod else: dic2[t] = v dic1,dic2 = dic2,dic1 dic2.clear() ans = 0 for k,v in dic1.items(): ans = (ans + v * abs(k)) % mod print(ans)