#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;

typedef long long ll;

ll dp[101][101][10001], MOD = 998244353, f[101];

int main() {
    f[0] = 1;
    rep(i, 0, 100) f[i + 1] = (f[i] * (i + 1)) % MOD;
    int N;
    cin >> N;
    vector<int> W(N);
    ll s = 0;
    rep(i, 0, N) {
        cin >> W[i];
        s += W[i];
    }
    if (s % 2) {
        cout << 0 << endl;
        return 0;
    }
    dp[0][0][0] = 1;
    rep(i, 0, N) {
        rep(j, 0, N) {
            rep(k, 0, j * 100 + 100) {
                dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j][k]) % MOD;
                dp[i + 1][j + 1][k + W[i]] = (dp[i + 1][j + 1][k + W[i]] + dp[i][j][k]) % MOD;
            }
        }
    }
    ll ans = 0;
    rep(i, 1, N) {
        ans = (ans + f[i] * f[N - i] % MOD * dp[N][i][s / 2]) % MOD;
    }
    cout << ans << endl;
    /*
    rep(i, 0, N + 1) {
        rep(j, 0, 101) {
            rep(k, 0, 10001) {
                if (dp[i][j][k] > 0) cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
            }
        }
    }
    */
}
/* Lucky_Glass */
#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 105, MOD = 998244353;

inline int add(int a, const int &b) { return (a += b) >= MOD ? a - MOD : a; }
inline int sub(int a, const int &b) { return (a -= b) < 0 ? a + MOD : a; }
inline int mul(const int &a, const int &b) { return int(1ll * a * b % MOD); }
#define ITERON(a, b, fun) a = fun(a, b)

int n;
int dp[2][N * N * 2][N], bino[N][N];

#define f(i, s, k) dp[(i) & 1][(s) + N * N][k]

int main() {
  scanf("%d", &n);
  f(0, 0, 0) = 1;
  for (int i = 1, tmp, sum = 0; i <= n; ++i) {
    scanf("%d", &tmp);
    for (int s = -sum; s <= sum; ++s)
      for (int k = 0; k <= i; ++k)
        f(i, s, k) = 0;
    for (int s = -sum; s <= sum; ++s)
      for (int k = 0; k <= i; ++k) {
        ITERON(f(i, s + tmp, k + 1), mul(f(i - 1, s, k), k + 1), add);
        ITERON(f(i, s - tmp, k), mul(f(i - 1, s, k), i - k), add);
      }
    sum += tmp;
  }
  
  int ans = 0;
  for (int k = 0; k <= n; ++k)
    ITERON(ans, f(n, 0, k), add);
  
  printf("%d\n", ans);
  return 0;
}