from collections import defaultdict as dd MOD = 998244353 n = int(input()) alst = list(map(int, input().split())) dp = dd(int) dp[0] = 1 for a in alst: dp2 = dd(int) for k, v in dp.items(): dp2[k - a] += v dp2[k + a] += v dp2[k - a] %= MOD dp2[k + a] %= MOD dp = dp2 ans = 0 for k, v in dp.items(): ans += abs(k) * v ans %= MOD print(ans)