#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD
#define MODSUB(SUB_X,SUB_Y)  ((SUB_X-SUB_Y)+MOD)%MOD
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD
#define LCM(LCM_X,LCM_Y) (LCM_X/__gcd(LCM_X,LCM_Y))*LCM_Y
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)998244353;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
ll dp[105][105][10050],arr[105],sum,n,fact[105];
ll recur(int pos,int cnt,int s)
{
    if(pos==n)
    {
        if((sum-s)==s)
        {
            int cnt2=n-cnt;
            return (fact[cnt]*fact[cnt2])%MOD;
        }
        return 0;
    }
    ll &ret=dp[pos][cnt][s];
    if(~ret) return ret;
    ret=0;
    ret+=recur(pos+1,cnt+1,s+arr[pos]);
    ret=(ret+recur(pos+1,cnt,s))%MOD;
    return ret;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    memset(dp,-1,sizeof(dp));
    fact[0]=1;
    for(int i=1; i<=100; i++)
        fact[i]=(fact[i-1]*i)%MOD;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
        sum+=arr[i];
    }
    cout<<recur(0,0,0)<<endl;

    return 0;
}

/* In the name of *Allah* *
 *   Thank You *Parsa*    */

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops, avx, avx2, fma")

#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<ios>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<numeric>
using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;

const int inf_int = 1 << 30;
const ll inf_longlong = 1LL << 62;
const int MOD = 998244353;

const int N = 100 + 5;
int n, w[N];
int dp[N][N * N], fact[N];

void init() {
	fact[0] = 1;
	for (int i = 1; i < N; i++)
		fact[i] = 1LL * fact[i - 1] * i % MOD;
}

void add(int &a, int b) {
	a += b;
	if (a >= MOD) a -= MOD;
}

void read_input() {
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> w[i];
}

void solve() {
	dp[0][0] = 1;

	for (int i = 1; i <= n; i++) {
		for (int k = i; k; k--) {
			for (int j = w[i]; j < N * N; j++) {
				add(dp[k][j], dp[k - 1][j - w[i]]);
			}
		}
	}
	int ans = 0, sum = accumulate(w + 1, w + n + 1, 0);
	if (sum % 2) {
		cout << 0 << '\n';
		return;
	}
	for (int i = 1; i < n; i++) {
		add(ans, 1LL * dp[i][sum / 2] * fact[i] % MOD * fact[n - i] % MOD);
	}
	cout << ans << '\n';
}

void write_output() {
}

int main() {
	ios:: sync_with_stdio(false), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	init();

	int test_cases = 1; //cin >> test_cases;
	while (test_cases--) {
		read_input(), solve(), write_output();
	}
	return 0;
}
// Thanks *Allah*