import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } sc.close(); int mod = 998244353; Map map = new HashMap<>(); map.put(0, 1L); for (int i = 0; i < n; i++) { Map wk = new HashMap<>(); for (Integer k : map.keySet()) { int next = k + a[i]; wk.put(next, (wk.getOrDefault(next, 0L) + map.get(k)) % mod); next = k - a[i]; wk.put(next, (wk.getOrDefault(next, 0L) + map.get(k)) % mod); } map = wk; } long ans = 0; for (Integer k : map.keySet()) { long val = Math.abs(k) * map.get(k) % mod; ans += val; } ans %= mod; System.out.println(ans); } }