#include "bits/stdc++.h"
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, m = 0, n = 0, p = 0, q = 0, mod =  
998244353
, pi = 3.1415926535;
    string s1, s2;
    char moji;

    cin >> a;
    vector<long long> v(a,0);
    vector<vector<vector<long long>>> dp(a+1,vector<vector<long long>>(5001,vector<long long>(51,0)));
  
    for(int i=0;i<a;i++)
    {
        cin >> v.at(i);
    }
    p=accumulate(v.begin(),v.end(),0);
    if(p%2)
    {
        cout << 0 << endl;
        return 0;
    }
  for(int i=0;i<a+1;i++)
  dp.at(i).at(0).at(0)=1;
      for(int j=0;j<a;j++)
      {
          for(int k=0;k<5001;k++)
          {
              for(int l=0;l<50;l++)
              {
                if(v.at(j)>k)
                {
                  dp.at(j+1).at(k).at(l+1)=dp.at(j).at(k).at(l+1);
                }
                else
                {
                  dp.at(j+1).at(k).at(l+1)=dp.at(j).at(k-v.at(j)).at(l)+dp.at(j).at(k).at(l+1);
                }
                dp.at(j+1).at(k).at(l+1)%=mod;
              }
          }
      }
      for(int i=1;i<a;i++)
      {
          n=dp.at(a).at(p/2).at(min((long long)i,a-i));
          for(int j=1;j<=i;j++)
          {
              n*=j;
              n%=mod;
          }
          for(int j=1;j<=a-i;j++)
          {
              n*=j;
              n%=mod;
          }
          m+=n;
          m%=mod;
      }
      cout << m << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
const int Mod = 998244353;
int N, a[105], f[105][20010], fac[105];
int main () {
#ifndef ONLINE_JUDGE
    freopen("cpp.in", "r", stdin);
#endif
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> a[i];
	for (int i = fac[0] = 1; i <= N; i++) fac[i] = 1ll * fac[i - 1] * i % Mod;
	int zero = 1e4 + 3;
	f[0][zero] = 1;
	for (int i = 1, sum = 0; i <= N; i++) {
		sum += a[i];
		for (int j = i; ~j; j--)
			for (int k = -sum + zero; k <= sum + zero; k++)
				if (j) f[j][k] = (f[j - 1][k - a[i]] + f[j][k + a[i]]) % Mod;
				else f[j][k] = f[j][k + a[i]];
	}
	int ans = 0;
	for (int i = 1; i <= N; i++)
		ans = (ans + 1ll * f[i][zero] * fac[i] % Mod * fac[N - i]) % Mod;
	cout << ans << endl;
    return 0;
}