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

typedef long long ll;

const int maxn=105;
const int mod=998244353;
int n,ans;
int w[maxn];
ll fac[maxn];

const int B=15000;
const int Q=40000;

int main() {
	fac[0]=1ll;
	for(ll i=1;i<=100;i++) fac[i]=fac[i-1]*i%mod;
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>w[i];
	vector<vector<int> > lst(n+5,vector<int>(Q,0));
	lst[0][B]=1;
	for(int i=1;i<=n;i++) {
		vector<vector<int> > now(n+5,vector<int>(Q,0));
		for(int j=1;j<=i;j++)
			for(int k=-10000;k<=10000;k++) {
				now[j][k+B]+=lst[j-1][k-w[i]+B];
				now[j][k+B]%=mod;
			}
		for(int j=0;j<=i;j++)
			for(int k=-10000;k<=10000;k++) {
				now[j][k+B]+=lst[j][k+w[i]+B];
				now[j][k+B]%=mod;
			}
		lst=now;
	}
	for(int i=0;i<=n;i++) {
		ans+=ll(lst[i][B])*fac[i]%mod*fac[n-i]%mod;
		ans%=mod;
	}
	cout<<ans<<endl;
	return 0;
}
/*
problem :
algorithm :
created : Programmer_juruo
*/

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

#define int long long
#define N 2000005
#define M 2005
#define lowbit(x) x & (-x)
#define F1(i, n) for(int i = 1; i <= n; i++)
#define F(i, a, n) for(int i = a; i <= n; i++)
#define F0(i, n) for(int i = 0; i < n; i++)
#define dbg(x) cout << #x << ":" << x << endl;
#define Se second
#define Fi first
#define y1 juruo
#define Mp make_pair
#define Pb push_back
#define arr vector<int>
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

typedef pair <int, int> pii;
typedef priority_queue <int> pq;
typedef long long ll;

const int inf = 0x3f3f3f3f;
const int p = 107;
const int P = 100007;
const int Mod = 1e9+7;

int n, m;

void work() {
	cin >> n;
	arr x(n+1);
	for(int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	sort(x.begin()+1, x.end());
	int Ans = 1, cnt = 0;
	for(int i = 1; i < x.size(); i++) {
		Ans *= (x[i] - x[i-1] +1);
		Ans %= Mod;
	}
	cout << Ans << endl;
}

signed main() {
  //freopen("1.in", "r", stdin);
  //freopen("1.out", "w", stdout);
  int T = 1;

  //cin >> T;

  while(T--) {
  	work();
  }

  return 0;
}

