voiddfs(int x, int s, int d) { if(x > (n >> 1) - 1) { if(map.find(d) == map.end()) map[d] = ++cnt; int t = map[d]; set[t].push_back(s); return; }
dfs(x + 1, s, d); dfs(x + 1, s | (1 << x), d + a[x]); dfs(x + 1, s | (1 << x), d - a[x]); }
voidDfs(int x, int s, int d) { if(x > n - 1) { if(map.find(d) == map.end()) return; int t = map[d]; for(RG iter it = set[t].begin(); it != set[t].end(); ++it) ok[(*it) | s] = 1; return; }
Dfs(x + 1, s, d); Dfs(x + 1, s | (1 << x), d + a[x]); Dfs(x + 1, s | (1 << x), d - a[x]); }
intmain() { n = read(); for(RG int i = 0; i < n; i++) a[i] = read(); dfs(0, 0, 0); Dfs((n >> 1), 0, 0); for(RG int i = (1 << n) - 1; i; i--) ans += ok[i]; printf("%d\n", ans); return0; }