#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using std::sort;
using std::cout;
using std::endl;
using std::max;
using std::min;

inline int read(){
	int h=0;char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')h=(h<<1)+(h<<3)+c-'0',c=getchar();
	return h; 
}

const int p=998244353;
inline int add(int x,int y){return x+y>=p?x+y-p:x+y;}
//long long ksm()/
const int MAXN=110;
int n;
int f[2][110][11111];
int nw=0,lst=1;
//前i个物品，A有j个，B有i-j个，A-B为w的方案数。 

int id(int x){return x+5001;}
int a[MAXN];
long long jc[MAXN];
//int jcn[MAXN];

int main(){
	jc[0]=1;for(int i=1;i<=100;i++)jc[i]=jc[i-1]*i%p;
	n=read();for(int i=1;i<=n;i++)a[i]=read();
	f[0][0][id(0)]=1;
	for(int i=1;i<=n;i++){
		std::swap(nw,lst);
		memset(f[nw],0,sizeof(f[nw]));
		for(int j=0;j<=i;j++){
			for(int d=-5000;d<=5000;d++){
				if(d+a[i]<=5000)f[nw][j+1][id(d+a[i])]=add(f[nw][j+1][id(d+a[i])],f[lst][j][id(d)]);
				if(d-a[i]>=-5000)f[nw][j][id(d-a[i])]=add(f[nw][j][id(d-a[i])],f[lst][j][id(d)]);
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++){
		ans=(ans+f[nw][i][id(0)]*jc[i]%p*jc[n-i])%p;
	}
	printf("%d\n",ans);
	return 0;
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
//#pragma GCC optimize("O3")
using namespace std;
using namespace __gnu_pbds;
auto random_address = [] { char *p = new char; delete p; return uint64_t(p); };
const uint64_t SEED = chrono::steady_clock::now().time_since_epoch().count() * (random_address() | 1);
mt19937_64 rng(SEED);
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n,v[1005],suma,dp[105][20005],aux[105][20005],fact[20005],f[20005],ans;
const ll mod=998244353;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    fact[0]=1;
    for(ll i=1;i<=1000;i++)
        fact[i]=(fact[i-1]*i)%mod;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        f[v[i]]++;
        suma+=v[i];
    }
    sort(v+1,v+n+1);
    if(suma%2==1)
    {
        cout<<0;
        return 0;
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
            for(int s=0;s<=suma;s++)
                aux[j][s]=dp[j][s];
        for(int j=1;j<=n;j++)
            for(int s=v[i];s<=suma;s++)
                dp[j][s]=(dp[j][s]+aux[j-1][s-v[i]])%mod;
    }
    for(ll j=1;j<=n;j++)
    {
        ll k=n-j;
        ll val=(fact[j]*fact[k])%mod;
        val=(val*dp[j][suma/2])%mod;
        /*if(j==n/2&&n%2==0)
            val=(val*2LL)%mod;*/
        ans=(ans+val)%mod;
    }
    cout<<ans<<'\n';
    return 0;
}
