#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
#define check(x) if(x>=mod) x-=mod
const int inf=0x3f3f3f3f,mod=998244353;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
int qpow(int x,int y){
    int ret = 1;
    while(y) {
        if(y & 1) ret = (ll)ret * x % mod;
        x = (ll)x * x % mod;
        y >>= 1;
    }
    return ret;
}
int n,p[105],fac[105];
int dp[105][5005][105];
int main()
{
    scanf("%d",&n);
    fac[0] = 1;rep(i,1,n) fac[i] = (ll)fac[i - 1] * i % mod;
    int sum = 0;
    rep(i,1,n) scanf("%d",p+i), sum += p[i];
    if(sum & 1) {
        puts("0");
        return 0;
    }
    dp[0][0][0] = 1;
    rep(i,1,n) {
        rep(j,0,sum/2) {
            rep(k,0,i) {
                dp[i][j][k] = dp[i - 1][j][k];
                if(p[i] <= j && k) dp[i][j][k] += dp[i - 1][j - p[i]][k - 1];
                check(dp[i][j][k]);
            }
        }
    }
    int ans = 0;
    rep(i,1,n) {
        int num = dp[n][sum/2][i];
        ans += (ll)num * fac[i] % mod * fac[n - i] % mod;
        check(ans);
    }
    printf("%d\n",ans);
    return 0;
}
#include <bits/stdc++.h>
const int mod=998244353;
using namespace std;
int T,n,m,fac[110],a[110],f[110][5010];
void init(int N){
	fac[0]=1;
	for(int i=1;i<=N;i++) fac[i]=1ll*fac[i-1]*i%mod;
}
void qmo(int &x){
	x+=(x>>31)&mod;
}
int main(){
	scanf("%d",&n),init(n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),m+=a[i];
	if(m&1) return puts("0"),0;
	m/=2,f[0][0]=1;
	for(int i=1;i<=n;i++) for(int j=i;j>=1;j--) for(int k=m;k>=a[i];k--){
		qmo(f[j][k]+=f[j-1][k-a[i]]-mod);
	}
	int res=0;
	for(int i=0;i<=n;i++) res=(res+1ll*fac[i]*fac[n-i]%mod*f[i][m])%mod;
	printf("%d\n",res);
}
