/*
    Code written by Talant I.D.
*/
 
#include <bits/stdc++.h>
//~ #include <ext/pb_ds/assoc_container.hpp>
 
//~ using namespace __gnu_pbds;
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
//~ typedef tree <ll, null_type, less_equal <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;
 
const int mod = 998244353;
 
ll mode(ll a) {
    while (a < 0) {
        a += mod;
    }
    return a % mod;
}
 
ll subt(ll a, ll b) {
    return mode(mode(a)-mode(b));
}
 
ll add(ll a, ll b) {
    return mode(mode(a)+mode(b));
}
 
ll mult(ll a, ll b) {
    return mode(mode(a)*mode(b));
}
 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b&1) res = mult(res, a);
        a = mult(a, a);
        b >>= 1;
    }
    return res;
}

ll dp[10003][103];
ll fact[10003];

int main() {
    do_not_disturb
    
    fact[0] = fact[1] = 1;
    for (ll i = 2; i < 10003; i++) {
        fact[i] = mult(fact[i-1], i);
    }
    dp[0][0] = 1;
    
    int n;
    cin >> n;
    vector <int> a(n);
    for (auto &to : a) cin >> to;
    
    for (auto to : a) {
        for (int i = 5000; i >= to; i--) {
            for (int j = 0; j < 100; j++) {
                dp[i][j+1] = add(dp[i][j+1], dp[i-to][j]);
            }
        }
    }
    
    ll ans = 0;
    ll sum = 0;
    for (auto to : a) sum += to;
    if (sum&1) {
        cout << 0;
        return 0;
    }
    sum /= 2;
    
    for (int i = 0; i <= 100; i++) {
        ans = add(ans, mult(dp[sum][i], mult(fact[i], fact[n-i])));
    }
    
    cout << ans;
    
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

#define endl '\n'
#define INF  0x3f3f3f3f
#define LINF  1LL<<62
#define MSET(a) memset(a, 0, sizeof(a))
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define key first
#define val second
#define pb push_back

template <typename T> bool ckmax(T &x, T y) {return x < y? (x = y, 1): 0;}
template <typename T> bool ckmin(T &x, T y) {return x > y? (x = y, 1): 0;}

inline int lc(int x) { return (x << 1);}
inline int rc(int x) { return (x << 1) + 1;}
inline int lowbit(int x) { return x&(-x);}

void extend_gcd(int64 a, int64 b, int64& d, int64& x, int64& y) {
  if (b) {
    extend_gcd(b, a%b, d, y, x);
    y -= a/b*x;
  } else d = a, x = 1, y = 0;
}

auto power(int64 a, int64 b, int64 mod) {
  int64 res = a % mod;
  while(b) {
    if (b&1) res = res * a % mod;
    a = a*a % mod;
    b >>= 1;
  }
  return res;
}

void SetupIo() {
  ios::sync_with_stdio(false);
  cin.tie(0);
}

void Main();

int main() {
  SetupIo();
  Main();
  return 0;
}

//----------------------

const int N = 2e4 + 10;
const int64 MOD = 998244353;

int n, m;
int a[N];

int64 dp[110][N];

int64 fac[N];

void pre() {
  fac[0] = 1;

  for(int i = 1; i < N; ++i) {
    fac[i] = fac[i-1]*i % MOD;
  }
  //for(int i = 0; i < 20; ++i) cout << fac[i] << endl;
}

int64 Ans() {
  int sum = 0;
  for(int i = 0; i < n; ++i) sum += a[i];

  if(sum % 2 == 1) return 0;

  int s = sum / 2;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;

  for(int i = 1; i <= n; ++i) {
    int v = a[i-1];
    for (int k = i; k >= 1; --k) {
      for(int j = s; j - v >= 0; --j) {
        dp[k][j] += dp[k-1][j-v];
        if (dp[k][j] >= MOD) dp[k][j] -= MOD;
      }
    }
  }

  int64 ans = 0;
  for(int i = 0; i <= n; ++i) {
    if (dp[i][s] != 0) {
      //cout << i << " " << s << ": " << dp[i][s] << endl;
      int64 x = fac[i]*fac[n-i] % MOD;
      ans += x*dp[i][s]%MOD;
      ans %= MOD;
    }
  }
  return ans;
}

void Main() {
  pre();
  cin >> n;
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  cout << Ans() << endl;
}
