#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
using namespace std;

template <typename T>
inline void read(T&x){
    x=0; char temp=getchar(); bool f=false;
    while(!isdigit(temp)){if(temp=='-') f=true; temp=getchar();}
    while(isdigit(temp)){x=(x<<1)+(x<<3)+temp-'0'; temp=getchar();}
    if(f) x=-x;
}
template <typename T>
void print(T x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) print(x/10);
    putchar(x%10+'0');
}

typedef long long ll;
const int MAXN = 105;
const ll mod = 998244353;

inline ll Add(ll x,ll y){return x+y>=mod? x+y-mod:x+y;}

//basic
int n,w[MAXN],pre[MAXN],sum,aim;
ll fac[MAXN];

//DP
ll f[MAXN][MAXN][MAXN*MAXN];

inline ll DP(){
    f[0][0][0]=1;
    for(register int i=1;i<=n;i++)
        for(register int j=0;j<=i;j++)
            for(register int k=0;k<=pre[i];k++){
                int x=k,y=pre[i]-k,now=w[i];
                if(j>0&&x-now>=0) f[i][j][x]=Add(f[i][j][x],f[i-1][j-1][x-now]);
                if(y-now>=0) f[i][j][x]=Add(f[i][j][x],f[i-1][j][x]);
            }
    ll res=0;
    for(register int i=0;i<=n;i++) res=Add(res,fac[i]*fac[n-i]%mod*f[n][i][aim]%mod);
    return res;
}

int main(){
    read(n),fac[0]=1;
    for(register int i=1;i<=n;i++) read(w[i]),sum+=w[i],pre[i]=pre[i-1]+w[i],fac[i]=fac[i-1]*i%mod;
    if(sum&1) return puts("0"),0;
    aim=sum>>1;
    print(DP());
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=998244353;
int f[105][10005],sum;
int n,w[105],p[105];
void add(int &x,int y){x+=y;if (x>=M)x-=M;}
int main(){
    cin >> n; f[0][0]=1;
    p[0]=1; for (int i=1;i<=n;i++) p[i]=1ll*p[i-1]*i%M;
    for (int i=0;i<n;i++) cin >> w[i];
    for (int i=0;i<n;i++){
        for (int j=i;j>=0;j--)
            for (int k=sum;k>=0;k--)
                add(f[j+1][k+w[i]],f[j][k]);
        sum+=w[i];
    }
    if (sum%2){puts("0");return 0;}
    int ans=0;
    for (int i=1;i<n;i++) add(ans,1ll*p[i]*p[n-i]%M*f[i][sum/2]%M);
    cout << ans << endl;
    return 0;
}
