#include <cstdio>
const long long mod = 998244353;
int w[105];
long long f[105][105][20005];

int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++) scanf("%d",&w[i]);
	f[0][0][10000] = 1;
	long long ans = 0;
	for(int i = 1; i <= n; i++){
		int u = w[i];
		for(int j = 0; j <= i; j++){
			for(int k = 0; k <= 20000; k++){
				f[i][j][k] = 0;
				if(j>0 && k-u>=0){
					long long add = f[i-1][j-1][k-u]*(long long)(j)%mod;
					f[i][j][k] = (f[i][j][k] + add)%mod;
				}
				if(k+u<=20000){
					int b = i-j-1;
					long long add = f[i-1][j][k+u]*(long long)(b+1)%mod;
					f[i][j][k] = (f[i][j][k] + add)%mod;
				}
				if(i==n && k==10000) ans = (ans + f[i][j][k])%mod;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

//clear adj and visited vector declared globally after each test case
//check for long long overflow  
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Incase of close mle change language to c++17 or c++14  
#include <bits/stdc++.h>     
#include <ext/pb_ds/assoc_container.hpp>  
#define int long long  
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 998244353ll
#define lld long double
#define mii map<int, int> 
#define pii pair<int, int>
#define ll long long
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
int dp[105][10005];
int fact[N],inv[N];
void pre()
{
    fact[0]=1;
    inv[0]=1;
    for(int i=1;i<N;i++)
    fact[i]=(i*fact[i-1])%mod;
    for(int i=1;i<N;i++)
    inv[i]=power(fact[i], mod-2, mod);
}
int32_t main()
{
    IOS;
    pre();
    int n;
    cin>>n;
    int a[n+1], s=0;
    rep(i,1,n+1)
    cin>>a[i], s+=a[i];
    if(s&1)
    {
        cout<<0;
        return 0;
    }
    dp[0][0]=1;
    int lim=10004;
    rep(i,1,n+1)
    {
        for(int j=n;j>0;j--)
        {
            for(int k=lim;k>=a[i];k--)
            {
                dp[j][k]+=dp[j-1][k-a[i]];
                if(dp[j][k]>=mod)
                dp[j][k]-=mod;
            }
        }
    }
    int ans=0;
    rep(i,1,n+1)
    {
        int op=n-i;
        if(op<i)
        break;
        if(i!=op)
        ans+=(((dp[i][s/2]*fact[i])%mod)*fact[op]*2ll)%mod;
        else
        ans+=(((dp[i][s/2]*fact[i])%mod)*fact[op])%mod;
        ans%=mod;
    }
    cout<<ans;
}