## https://yukicoder.me/problems/no/1645 MOD = 998244353 def main(): N = int(input()) A = list(map(int, input().split())) max_a = sum([abs(a) for a in A]) dp = {0:1} for a in A: new_dp = {} for key, value in dp.items(): if (key + a) not in new_dp: new_dp[key + a] = 0 new_dp[key + a] += value new_dp[key + a] %= MOD if (key - a) not in new_dp: new_dp[key - a] = 0 new_dp[key - a] += value new_dp[key - a] %= MOD dp = new_dp answer = 0 for key, value in dp.items(): k = abs(key) answer += (k * value) % MOD answer %= MOD print(answer) if __name__ == "__main__": main()