#include <bits/stdc++.h>
#define int long long
#define pb push_back

#define vi vector<int>
#define vii vector<vi>
#define viii vector<vii>


#define all(a) a.begin(), a.end()
#define sz(a) a.size()

const int mod=998244353;
using namespace std;


void solve()
{
    int n;
    cin >> n;
    vi w(n + 1);
    int summ = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> w[i];
        summ += w[i];
    }

    if (summ % 2==1)
        cout << 0;
    else
    {
        summ /= 2;
        vi fact(n + 1);
        fact[0] = 1, fact[1] = 1;

        for (int i = 2; i <= n; i++)
        {
            fact[i] = i * fact[i - 1];
            fact[i] %= mod;
        }

        int ans = 0, curr;

        viii dp(n + 1, vii(summ + 1, vi(n + 1, 0)));

        dp[0][0][0] = 1;
        for (int i = 1; i <= n; i++)
        {
            for (int j = 0; j <= summ; j++)
            {
                for (int k = 0; k <= i; k++)
                {
                    dp[i][j][k] = dp[i - 1][j][k];
                    dp[i][j][k] %= mod;
                    if (w[i] <= j && k > 0)
                    {
                        dp[i][j][k] += dp[i - 1][j - w[i]][k - 1];
                        dp[i][j][k] %= mod;
                    }
                    if (i == n && j == summ)
                    {
                        curr = dp[i][j][k] * fact[k];
                        curr %= mod;
                        curr = curr * fact[n - k];
                        curr %= mod;
                        ans += curr;
                        ans %= mod;
                    }
                }
            }
        }
        cout << ans;
    }
}

int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
#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;
}