/*
设dp[i][j]为当前算到tak拿了i个物品，它的和为j的方案数。 
*/
#include<cstdio>
const long long mod=998244353;
long long n,w[110],sum,dp[110][10010],power[110],ans;
int main()
{
	scanf("%lld",&n);
	for(long long i=1;i<=n;++i)	scanf("%lld",&w[i]);
	dp[0][0]=1;
	power[0]=1;
	for(long long i=1;i<=n;++i)
	{
		power[i]=(power[i-1]*i)%mod;
		for(long long j=i-1;j>=0;--j)
		{
			for(long long k=0;k<=sum;++k)	dp[j+1][k+w[i]]=(dp[j+1][k+w[i]]+dp[j][k])%mod;
		}
		sum+=w[i];
	}
	if(sum%2==0)
	{
		for(long long i=1;i<=n;++i)	ans=(ans+((power[i]*power[n-i])%mod)*dp[i][sum/2])%mod;
	}
	printf("%lld\n",ans);
	return 0;
}
#include <bits/stdc++.h>
const int N = 105, P = 998244353;
int n, a[N], sum = 0, f[N][N * N], g[N][N * N], fac[N]; // 1：当前权值；2：<0次数
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]), sum += a[i];
	if (sum & 1) { puts("0"); return 0; }
	fac[1] = 1;
	for (int i = 2; i <= n; i++)
		fac[i] = 1ll * fac[i - 1] * i % P;
	f[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		memset(g, 0, sizeof g);
		for (int j = 0; j <= i; j++)
			for (int k = 0; k <= i * 100; k++) {
				g[j][k] = f[j][k];
				if (j && k >= a[i]) g[j][k] = (g[j][k] + f[j - 1][k - a[i]]) % P;
			}
		memcpy(f, g, sizeof g);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
		ans = (ans + 1ll * fac[i] * fac[n - i] % P * g[i][sum / 2]) % P;
	printf("%d\n", ans);
	return 0;
}