import sys import math from collections import deque,Counter from sys import stdin #sys.setrecursionlimit(10**7) int1=lambda x: int(x)-1 inp=lambda :int(input()) mi=lambda :map(int,input().split()) li=lambda :list(mi()) mi1=lambda :map(int1,input().split()) li1=lambda :list(mi1()) mis=lambda :map(str,input().split()) lis=lambda :list(mis()) stinput=lambda :stdin.readline()[:-1] stinp=lambda :int(stinput()) stmi=lambda :map(int, stdin.readline().split()) stli=lambda :list(stmi()) stmi1=lambda :map(int1, stdin.readline().split()) stli1=lambda :list(stmi1()) stmis=lambda :stdin.readline()[:-1] pr=print from collections import defaultdict """ #初期値 0 d=defaultdict(int) #初期値 1 d=defaultdict(lambda:1) """ mod=10**9+7 Mod=998244353 INF=10**18 ans=0 n=int(input()) a=li() d=defaultdict(int) d[0]=1 for i in a: d2=defaultdict(int) for j in d: d2[j+i]+=d[j] d2[j-i]+=d[j] d=d2.copy() for i in d2: ans+=d2[i]*abs(i) print(ans%Mod)