N = int(input()) A = list(map(int,input().split())) mod = 998244353 dic1 = {A[0]:1,-A[0]:1} dic2 = {} for i in range(1,N): for k,v in dic1.items(): t = A[i] + k if t in dic2: dic2[t] += v else: dic2[t] = v t = - A[i] + k if t in dic2: dic2[t] += v 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)