from collections import defaultdict MOD = 998244353 N = int(input()) A = list(map(int,input().split())) now = defaultdict(int) now[0] = 1 for i in range(N): next = defaultdict(int) for j in now: next[j + A[i]] += now[j] next[j + A[i]] %= MOD next[j - A[i]] += now[j] next[j - A[i]] %= MOD now,next = next,now ans = 0 for i in now: ans += abs(i) * now[i] ans %= MOD print(ans)