#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <vector>
#include <list>
#include <cmath>
#include <map>
#include <deque>
#include <utility>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <string>
#include <stack>
#include <set>
#include <functional>
#include <iterator>
#include <algorithm>

using namespace std;

typedef long long ll;


class UnionFind {
private:
    vector<int> f;
    int _components;
public:
    explicit UnionFind(int sz): f(sz), _components(sz) {
        for (int i = 0; i < sz; i++) {
            f[i] = i;
        }
    }

    int find(int x) {
        if (x == f[x]) return x;
        int fa = f[x];
        return f[x] = find(fa);
    }

    void add(int x, int y) {
        int fx = find(x), fy = find(y);
        if (fx != fy) {
            _components--;
        }
        f[fx] = fy;
    }
    int components() const {
        return _components;
    }
};

ll gcd(ll a, ll b) {
    if (b == 0)return a;
    else return gcd(b, a%b);
}



int main(int argc, char *argv[]) {
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    const int mod = 1e9+7;
    int n;
    cin >> n;
    vector<ll> arr(n);
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr.begin(), arr.end());
    ll ret = arr[0] + 1;

    for (int i = 1; i < n; i++) {
        ret *= (arr[i] - arr[i-1] + 1);
        ret %= mod;
    }
    cout << ret << endl;
}
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x) cerr << "[" << #x << "]: " << x << "\n";

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;

ld const PI = 4*atan((ld)1);

template<int MOD = 998'244'353>
struct Mint
{
	int val;

	Mint() : val(0) {}
	Mint(ll _val) : val((int)(_val % MOD)) { if (val < 0) val += MOD; }

	Mint& operator+= (const Mint &rhs) { val += rhs.val; if (val >= MOD) val -= MOD; return *this; }
	Mint& operator-= (const Mint &rhs) { val -= rhs.val; if (val < 0) val += MOD; return *this; }
	Mint& operator*= (const Mint &rhs) { val = (int)((ll) val * rhs.val % MOD); return *this; }

	friend Mint fpow(Mint x, ll y)
	{
		Mint res = 1;
		for (; y > 0; y >>= 1, x *= x)
		{
			if (y & 1)
				res *= x;
		}
		return res;
	}
	friend Mint inverse(Mint x) { return fpow(x, MOD-2); }
	Mint& operator/= (const Mint &rhs) { return *this *= inverse(rhs); }

	friend Mint operator+ (Mint a, const Mint &b) { return a += b; }
	friend Mint operator- (Mint a, const Mint &b) { return a -= b; }
	friend Mint operator- (Mint a) { return 0 - a; }
	friend Mint operator* (Mint a, const Mint &b) { return a *= b; }
	friend Mint operator/ (Mint a, const Mint &b) { return a /= b; }
	friend ostream& operator<< (ostream &os, const Mint &a) { return os << a.val; }
	friend bool operator== (const Mint &a, const Mint &b) { return a.val == b.val; }
	friend bool operator!= (const Mint &a, const Mint &b) { return a.val != b.val; }
};


const int MAX = 107;

int n;
int w[MAX];
Mint<> dp[MAX][MAX * MAX]; //dp[a][b], pick a items such that the weigh sum is exactly b
Mint<> fact[MAX];

int main()
{
	fastio;

	fact[0] = 1;
	for (int i = 1; i < MAX; ++i)
		fact[i] = i * fact[i-1];


	cin >> n;
	
	int sum = 0;
	for (int i = 0; i < n; ++i)
		cin >> w[i], sum += w[i];

	if (sum & 1)
	{
		cout << 0 << '\n';
		return 0;
	}

	dp[0][0] = 1;
	for (int i = 0; i < n; ++i)
	{
		for (int a = n-1; a >= 0; --a)
		{
			for (int b = 10000; b >= 0; --b)
			{
				dp[a+1][b + w[i]] += dp[a][b];
			}
		}
	}

	Mint<> res = 0;
	for (int i = 1; i <= n; ++i)
	{
		res += dp[i][sum/2] * fact[i] * fact[n-i];
	}
	cout << res << '\n';

	return 0;
}
