#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 998244353;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, w[101], ex[101], sm, dp[2][100 * 101][101];

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    cin >> n;
    zep(i, 0, n)cin >> w[i];

    ex[0] = 1;
    rep(i, 1, n)ex[i] = i * ex[i - 1] % MOD;

    zep(i, 0, n)sm += w[i];
    if(sm % 2 == 1){print(0) return 0;}

    dp[0][0][0] = 1;
    zep(i, 0, n){
        memset(dp[(i + 1) % 2], 0, sizeof(dp[(i + 1) % 2]));

        rep(j, 0, sm / 2){
            rep(k, 0, i){
                dp[(i + 1) % 2][j][k] += dp[i % 2][j][k];
                dp[(i + 1) % 2][j][k] %= MOD;
                dp[(i + 1) % 2][j + w[i]][k + 1] += dp[i % 2][j][k];
                dp[(i + 1) % 2][j + w[i]][k + 1] %= MOD;
            }
        }
    }
    
    ll ans = 0;
    zep(k, 1, n){
        ans += dp[n % 2][sm / 2][k] * (ex[k] * ex[n - k] % MOD) % MOD;
        ans %= MOD;
    }
    print(ans)

    return 0;
}
#include<bits/stdc++.h>
using namespace std;

const long long int MOD = 998244353;
 
void solve() {
	int n; cin >> n;
  	vector<int> a(n);
  	long long int sum = 0;
  	for (int i = 0; i < n; i++) {
    	cin >> a[i];
      	sum += a[i];
    }
  
  	if (sum % 2) {
    	cout << 0;
      	return;
    }
  
    vector<long long int> f(n + 1, 1);
  	vector<vector<long long int>> dp(sum + 1, vector<long long int>(n + 1, 0));
  	dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
        f[i] = f[i - 1] * i % MOD;
  
    for (int i = 0; i < n; i++) {
        for (int j = n; j > 0; j--) {
            for (int k = sum; k >= a[i]; k--) {
                dp[k][j] += dp[k - a[i]][j - 1];
                dp[k][j] %= MOD;
            }
        }
    }

    long long int ans = 0;
    for (int i = 0; i <= n; i++) {
        ans += dp[sum / 2][i] * f[i] % MOD * f[n - i] % MOD;
        ans %= MOD;
    }
    cout << ans;
}

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

	int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}