RT
#include <bits/stdc++.h>
using namespace std;
int n, w[21], ans;
map <int, int> maps;
void dfs(int x, int a, int b){
if (x == (n >> 1 | 1)){
if (a - b == 0){
return;
}
maps[a - b]++;
return;
}
dfs(x + 1, a, b);
dfs(x + 1, a + w[x], b);
dfs(x + 1, a, b + w[x]);
return;
}
void dfs2(int x, int c, int d){
if (x == n + 1){
ans += maps[d - c];
return;
}
dfs2(x + 1, c, d);
dfs2(x + 1, c + w[x], d);
dfs2(x + 1, c, d + w[x]);
return;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++){
cin >> w[i];
}
dfs(1, 0, 0);
dfs2(n >> 1 | 1, 0, 0);
cout << (ans >> 1);
return 0;
}