#define MOD 998244353
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#include <numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,sw{0};
	int64_t ans{0};
	array < int64_t , 101 > fact;
	cin>>n;
	vector < int64_t > w(n);
	vector < array < int64_t , 10001 > > dp(n+1);
	fact[0]=1;
	dp[0].fill(0);
	for(int i=0; i<n; ++i){
		cin>>w[i];
		dp[i+1].fill(0);
		sw+=w[i];
	}
	dp[0][0]=1;
	for(int i=0; i<n; ++i){//element to be added
		for(int j=n-1; j>=0; --j){//size of current subset
			for(int k=0; k<dp[j].size()-w[i]; ++k){//weight of current subset
				dp[j+1][k+w[i]]+=dp[j][k];
				dp[j+1][k+w[i]]%=MOD;
			}
		}
	}
	for(int i=1; i<fact.size(); ++i){
		fact[i]=(i*fact[i-1])%MOD;
	}
	for(int i=0; i<dp.size(); ++i){
		ans+=(((dp[i][sw/2]*fact[i])%MOD)*fact[n-i])%MOD;
		ans%=MOD;
	}
	if(sw&1){
		cout<<0<<'\n';
	}
	else{
		cout<<ans<<'\n';
	}
}

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
//#pra gma G CC opti mize(3)
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
	template<class T>
	inline void read(T &x) {
		x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		if(fu)x=-x;
	}
	inline int read() {
		int x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		return fu?-x:x;
	}
	template<class T,class... Args>
	inline void read(T& t,Args&... args) {
		read(t);
		read(args...);
	}
	char _n_u_m_[40];
	template<class T>
	inline void write(T x ) {
		if(x==0){
			putchar('0');
			return;
		}
		T tmp = x > 0 ? x : -x ;
		if( x < 0 ) putchar('-') ;
		register int cnt = 0 ;
		while( tmp > 0 ) {
			_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
			tmp /= 10 ;
		}
		while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
	}
	template<class T>
	inline void write(T x ,char ch) {
		write(x);
		putchar(ch);
	}
}
using namespace fastIO;
#define mod 998244353
ll dp[102][102][10005],a,n;
int main() {
	dp[0][0][5002]=1;
	F(iakioi,1,n=read()){
		read(a);
		#define j iakioi-i
		F(i,1,iakioi)F(k,1,10004-a){
			dp[i][j][k]=(dp[i][j][k]+dp[i-1][j][k+a])%mod;
		}
		F(i,0,iakioi-1)F(k,a+1,10004){
			dp[i][j][k]=(dp[i][j][k]+dp[i][j-1][k-a])%mod;
		}
		#undef j
	}ll ans=0;
	F(i,0,n){
		ll orz=1;ri j=n-i;
		F(k,1,i)orz=orz*k%mod;
		F(k,1,j)orz=orz*k%mod;
		ans+=orz*dp[i][j][5002]%mod;
	}
	cout<<ans%mod;
	return 0;
}
