#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define ll long long
#define rep(i,n) for(int i = 0;i < (int)n;i ++)
#define mod % 998244353
using namespace std;


int main(void){
  ll n;
  cin >> n;
  ll A[n+1];
  A[0] = 1;
  rep(i,n){
    A[i+1] = (A[i]*(i+1))mod;
  }
  vector<ll> w(n);
  ll S = 3;
  rep(i,n){
    cin >> w[i];
    S += w[i];
  }
  sort(w.begin(),w.end());
  ll Q = S;
  vector<vector<vector<ll>>> P(n+1,vector<vector<ll>>(Q,vector<ll>(n+1,0)));
  P[0][Q/2][0] = 1;
  rep(i,n){
    rep(j,Q){
      
      rep(k,n+1){
        P[i][j][k] = P[i][j][k] mod;
        if(P[i][j][k] > 0){
          if(j+w[i]<Q)P[i+1][j+w[i]][k+1] = (P[i+1][j+w[i]][k+1]+P[i][j][k]) mod;
          if(j-w[i]>=0)P[i+1][j-w[i]][k] = (P[i+1][j-w[i]][k]+P[i][j][k]) mod;
        }
      }
    }
  }
  vector<ll> ans = P[n][Q/2];
  ll sum = 0;
  rep(i,n){
    ll M = (A[i]*A[n-i]) mod;
    sum = (sum+ans[i]*M) mod;
  }
  cout << sum << endl;
  return 0;
}
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int mod = 998244353;
int add(int a, int b) {
	return a + b >= mod ? a + b - mod : a + b; 
}
int mul(int a, int b) {
	return 1ll * a * b % mod;
}
int dec(int a, int b) {
	return a - b < 0 ? a - b + mod : a - b;
}
void Add(int &a, int b) {
	a = add(a, b);
}
void Dec(int &a, int b) {
	a = dec(a, b);
}
void Mul(int &a, int b) {
	a = mul(a, b);
}
int ksm(int a, int b) {
	int ans = 1; for(; b; b >>= 1, Mul(a, a))
	if(b & 1) Mul(ans, a);
}
cs int N = 105, M = N * N; 
int n, a[N];
int dp[N][M], fc[N];
int main() {
	#ifdef FSYo
	freopen("1.in", "r", stdin);
	#endif
	cin >> n;
	dp[0][0] = 1;
	int S = 0; 
	for(int i = 1, x; i <= n; i++) {
		scanf("%d", &x);
		for(int j = i - 1; ~j; j--)
		for(int k = 0, c; k <= S; k++)
		if(c = dp[j][k]) 
		Add(dp[j + 1][k + x], c);
		S += x; 
	}
	if(S & 1) return puts("0"), 0; 
	S >>= 1; 
	fc[0] = 1; 
	for(int i = 1; i <= n; i++)
		fc[i] = mul(fc[i - 1], i);
	int ans = 0; 
	for(int i = 1; i < n; i++) {
		Add(ans, mul(dp[i][S], mul(fc[i], fc[n - i])));
	}
	cout << ans; 
	return 0; 
}