#include <bits/stdc++.h>
using namespace std;

long long cur[101][10001], pre[101][10001];
long long MOD = 998244353;
int main() {
    int N; cin >> N;
    vector<int> W(N);
    for(int i = 0; i < N; i++) {
        cin >> W[i];
    }
    pre[0][0] = 1LL;

    int sum = 0;
    for(int i = 0; i < N; i++)
        sum += W[i];
    for(int i = 1; i <= N; i++) {
        for(int make = 0; make <= sum; make++) {
            for(int use = 0; use <= N; use++) {
                cur[use][make] = pre[use][make];
                if(W[i - 1] <= make && use > 0)
                    cur[use][make] += pre[use - 1][make - W[i - 1]];
                if(cur[use][make] > MOD) cur[use][make] -= MOD;
            }
        }
        for(int make = 0; make <= sum; make++)
            for(int use = 0; use <= N; use++)
                pre[use][make] = cur[use][make];
    }
    vector<long long> f(N + 1);
    f[0] = 1LL;
    for(int i = 1; i <= N; i++)
        f[i] = f[i - 1] * 1LL * i % MOD;
    long long ans = 0LL;
    if(sum % 2) {
        cout << 0 << "\n";
        return 0;
    }
    for(int use = 0; use <= N; use++) {
        ans += f[use] * 1LL * f[N - use] % MOD * pre[use][sum / 2] % MOD;
        ans %=  MOD;
    }
    if(ans < 0) ans += MOD;
    cout << ans;
}

#include<bits/stdc++.h>
using namespace std;

typedef long long s64;
const int N=100+5,D=998244353;
int dp[N*N][N];
s64 fact[N];

int main(){
#ifdef kcz
	freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
#endif
	int n;
	cin>>n;
	int sum=0;
	bool d=0;
	dp[0][0]=1;
	for(int i=1;i<=n;++i){
		d^=1;
		int w;
		cin>>w;
		sum+=w;
		for(int j=sum;j>=w;--j)
		for(int k=1;k<=i;++k)(dp[j][k]+=dp[j-w][k-1])%=D;
	}
	if(sum%2){
		puts("0");
		exit(0);
	}
	fact[0]=1;
	for(int i=1;i<=n;++i)fact[i]=fact[i-1]*i%D;
	s64 ans=0;
	for(int k=0;k<=n;++k){
		(ans+=dp[sum/2][k]*fact[k]%D*fact[n-k])%=D;
	}
	cout<<ans<<endl;
}