#include<bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef long long int ll;
typedef string S;
#define M 1e18
#define AS 250005
#define sp cout<<' '
#define nw cout<<endl
#define rt return
#define __ template<typename T, typename... Types>
void in() {rt;} __ void in(T &a, Types&... b){cin>>(a); in(b...);}
void o() {rt;}  __ void o(T a, Types... b){cout<<(a);sp; o(b...);}
#define fr(Hi,a,n) for(ll Hi=a;Hi<=n;Hi++)
#define frm(Hi,a,n) for(ll Hi=n;Hi>=a;Hi--)
#define P pair<ll,ll>
#define vc vector<ll>
#define pb push_back
#define MP map<ll,ll>
bool sortin(const pair<ll,ll> &e,const pair<ll,ll> &f){return (e.first<f.first);}
bool POT(ll x){return x && (!(x&(x-1)));}
ll i,j,k,l,m,n,p,q,r,a,b,c,x,y,z,ts,mn=1e18,mod=998244353;
ll ar[AS],br[AS],xr[AS],tem[AS];
ll dp[107][5007];
int main()
{
    fast;
    in(n);
    fr(i,1,n)in(ar[i]),c+=ar[i];
    if(c%2){o(0);rt 0;}
    c/=2;
    dp[0][0]=1;
    xr[0]=1;
    fr(k,1,n)
    {
        xr[k]=(xr[k-1]*k)%mod;
        frm(i,1,n)
        {
            frm(j,ar[k],c)
            {
                dp[i][j]+=dp[i-1][j-ar[k]];
                dp[i][j]%=mod;
            }
        }
    }
    ll ans=0;
    fr(i,1,n)
    {
        ans=(ans+dp[i][c]*xr[i]%mod*xr[n-i]%mod)%mod;
    }
    o(ans);
}


#include<cstdio>
#define N 105
#define ll long long
#define mo 998244353
using namespace std;

int n,w[N],W;
ll f[N][N*N][N],P[N];
#define dp(x,y) x=(y+x)%mo
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;++i)scanf("%d",&w[i]),W+=w[i];
	if (W&1)
	{
		puts("0");
		return 0;
	}W>>=1;
	P[0]=1;
	for (int i=1;i<=n;++i)
	P[i]=P[i-1]*i%mo;

	f[0][W][0]=1;
	for (int i=0;i<n;++i)
		for (int j=0;j<=W+W;++j)
			for (int k=0;k<=n;++k)
			if (f[i][j][k])
			{
				if (j+w[i+1]<=W+W)
				dp(f[i+1][j+w[i+1]][k+1],f[i][j][k]);
				if (j-w[i+1]>=0)
				dp(f[i+1][j-w[i+1]][k],f[i][j][k]);
			}
	ll ans=0;
	for (int i=1;i<n;++i)
	if (f[n][W][i])
	dp(ans,f[n][W][i]*P[i]%mo*P[n-i]);
	printf("%lld\n",ans);
	return 0;
}