#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

#define N 10100
#define MOD 998244353
#define ll long long
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define rep3(i, a, b) for(int i = a; i >= b; --i)
#define eb emplace_back
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
struct Setup_io {
	Setup_io() {
		ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
		cout << fixed << setprecision(15);
	}
} setup_io;



int main() {
	int n;
	int x, s;
	int a[100];
	ll dp[101][N];
	ll k[110];
	ll y, z;
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n + 1) {
		rep(j, N)dp[i][j] = 0;
	}
	s = 0;
	dp[0][0] = 1;
	rep(i, n) {
		s += a[i];
		rep3(ii, i, 0) {
			rep3(j, 100*(i+1), a[i])dp[ii + 1][j] = (dp[ii + 1][j] + dp[ii][j - a[i]]) % MOD;
		}
	}
	if (s % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}
	s /= 2;
	k[0] = 1;
	rep2(i, 1, 100) {
		y = (ll)i;
		k[i] = (k[i - 1] * y) % MOD;
	}
	ll ans = 0;
	rep(i, n + 1) {
		y = dp[i][s];
		y = (y*k[i]) % MOD;
		y = (y*k[n - i]) % MOD;
		ans = (ans + y) % MOD;
	}
	cout << ans << endl;
	return 0;
}

#include <cstdio>
#include <cstring>
const int maxn=100+10;
const int Mod=998244353;
int w[maxn];
int dp[2][maxn][maxn*maxn*2];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&w[i]);
	int ze=100*100+100;
	int now=0;
	dp[now^1][0][ze]=1;
	for(int i=1;i<=n;i++,now^=1){
		memset(dp[now],0,sizeof(dp[now]));
		for(int k=0;k<=i;k++)
			for(int j=ze-100*100;j<=ze+100*100;j++)
				dp[now][k][j]=((k?1ll*dp[now^1][k-1][j-w[i]]*k:0)+1ll*dp[now^1][k][j+w[i]]*(i-k))%Mod;
	}
	int ans=0;
	for(int i=0;i<=n;i++)
		ans=(ans+dp[now^1][i][ze])%Mod;
	printf("%d",ans);
	return 0;
}