#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

const ll MOD=998244353;

ll dp[102][102][10004];

int main(){FIN;
	ll n; cin>>n;
	vector<ll> a(n);
	fore(i,0,n)cin>>a[i];
	for(ll x=n;x>=0;x--){
		for(ll y=x;y>=0;y--){
			fore(z,0,10004){
				ll &res=dp[x][y][z];
				if(x==n){
					if(z==0)res=1;
					else res=0;
				}else{
					res=dp[x+1][y+1][z+a[x]]*(y+1);
					if(a[x]<=z){
						res=(res+dp[x+1][y][z-a[x]]*(x+1-y))%MOD;
					}else{
						res=(res+dp[x+1][x-y+1][a[x]-z]*(x+1-y))%MOD;
					}
				}
			}
		}
	}
	cout<<dp[0][0][0]<<"\n";
	
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#ifdef LOCAL
#include "debug.hpp"
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

ll MOD = 998244353;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll N; cin >> N;
  vector<ll> W(N); for (ll i = 0; i < N; i++) cin >> W[i];
  ll SUM = 0;
  for (ll i = 0; i < N; i++) {
    SUM += W[i];
  }
  if (SUM % 2) {
    cout << 0 << '\n';
    return 0;
  }

  // i 番目までを見たとき、j個を使ってkを作る数
  SUM /= 2;
  vector<vector<ll>> dp(N + 1, vector<ll>(SUM + 1, 0));
  dp[0][0] = 1;
  for (ll i = 0; i < N; i++) {
    vector<vector<ll>> dp2 = dp;
    for (ll j = 0; j < N; j++) {
      for (ll k = 0; k < SUM + 1; k++) {
        ll w = k + W[i];
        if (w > SUM) continue;
        dp2[j + 1][w] += dp[j][k];
        dp2[j + 1][w] %= MOD;
      }
    }
    dp = dp2;
  }
  debug(dp);

  vector<ll> factorial(N + 1, 1);
  for (ll i = 1; i <= N; i++) {
    factorial[i] = factorial[i - 1] * i;
    factorial[i] %= MOD;
  }

  ll ans = 0;
  for (ll k = 0; k < N; k++) {
    ll temp = dp[k][SUM];
    temp = (temp * factorial[k]) % MOD;
    temp = (temp * factorial[N - k]) % MOD;
    ans = (ans + temp) % MOD;
  }

  cout << ans << '\n';
  return 0;
}