#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=110,maxm=0,mod=998244353;
int n;
int w[maxn],cnt[maxn];
int f[2][maxn][maxn*maxn];
int C[maxn][maxn],P[maxn];
inline int read(){
    int res=0;
    char ch=getchar(),ch1=ch;
    while(!isdigit(ch))ch1=ch,ch=getchar();
    while(isdigit(ch))res=(res<<3)+(res<<1)+ch-'0',ch=getchar();
    return ch1=='-'?-res:res;
}
int qpow(int x,int k){
    int res=1;
    while(k){
        if(k&1)res=1ll*res*x%mod;
        x=1ll*x*x%mod;
        k>>=1;
    }
    return res;
}
void reset(){
    C[0][0]=1;
    for(int i=1;i<=100;++i){
        C[i][0]=1;
        for(int j=1;j<=i;++j)
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
    }
    P[0]=1;
    for(int i=1;i<=100;++i)
        P[i]=(P[i-1]*1ll*i)%mod;
}
void proc(){
    n=read();
    int tnt=0;
    for(int i=1;i<=n;++i){
        w[i]=read();
        tnt+=w[i];
        ++cnt[w[i]];
    }
    if(tnt&1){
        puts("0");return;
    }
    tnt>>=1;
    reset();
    f[0][0][0]=1;
    int flag=0;
    for(int i=1,sum=0;i<=100;++i){
        if(!cnt[i])continue;
        for(int j=0;j<=sum;++j)
            for(int k=0;k<=tnt;++k){
                f[flag^1][j][k]=0;
            }
        for(int j=0;j<=sum;++j){
            for(int k=0;k<=tnt;++k){
                if(!f[flag][j][k])continue;
                for(int l=0;l<=cnt[i];++l)
                    f[flag^1][j+l][k+l*i]=(f[flag^1][j+l][k+l*i]+1ll*f[flag][j][k]*C[j+l][l]%mod*C[sum-j+cnt[i]-l][cnt[i]-l]%mod*P[cnt[i]]%mod)%mod;
            }
        }
        sum+=cnt[i];
        flag^=1;
    }
    int ans=0;
    for(int i=0;i<=n;++i)
        ans=(ans+f[flag][i][tnt])%mod;
    cout<<ans<<endl;
}
int main(){
    int T=1;
    while(T--)proc();
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

const int mod = 998244353;

int n;
int a[110];
int dp[110][10010];

void ADD(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	dp[0][0] = 1;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		int x = a[i]; sum += x;
		for (int j = i + 1; j >= 0; j--) {
			for (int k = sum; k >= 0; k--) {
				dp[j][k] = (1ll * dp[j][k] * (i + 1 - j) + 1ll * (k >= x && j ? dp[j - 1][k - x] : 0) * j) % mod;
			}
		}
	}
	if (sum & 1) {
		cout << 0 << endl;
		return 0;
	}
	int ans = 0;
	for (int j = 0; j <= n; j++) ADD(ans, dp[j][sum / 2]);
	cout << ans << endl;
	return 0;
}
