#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(int)(x);i<(int)(y);i++)
#define print(A,x,n) {rep(I,0,n){cout<<(I ? " ":"")<<A[I]x;}cout<<endl;}
#define pprint(A,y,m,n) {rep(J,0,m){print(A[J],y,n);}}
const long mod=998244353;
const int siz=3e5;
const int inf=1e6;
int main(){
	int N; cin>>N;
	int w, sum = 0;
	long dp[N+1][10001] = {}; dp[0][0] = 1;
	rep(i,1,N+1){
		cin>>w;
		sum += w;
        for(int j = i; j > 0; j--){
            rep(k,w,10001) (dp[j][k] += dp[j-1][k-w]) %= mod;
        }
	}
	if(sum % 2 == 1){
		cout<<0<<endl;
		return 0;
	}
	long ans = 0;
	long fact[N+1]; fact[0] = 1;
	rep(i,1,N+1) fact[i] = fact[i-1] * i % mod;
	rep(i,1,N+1){
		long k = fact[i] * fact[N-i] % mod;
		(ans += dp[i][sum/2] * k % mod) %= mod;
	}
	cout<<ans<<endl;
}
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pine1999
 */


#include <bits/stdc++.h>

template<int mod>
class Modular {
private:
    int x;
public:
    Modular() : x(0) {}
    Modular(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    Modular &operator+=(const Modular& p) { if ((x += p.x) >= mod) x -= mod; return *this; }
    Modular &operator-=(const Modular& p) { if ((x -= p.x) < 0) x += mod; return *this; }
    Modular &operator*=(const Modular& p) { x = (int) (1LL * x * p.x % mod); return *this; }
    Modular &operator/=(const Modular& p) { *this *= p.Inverse(); return *this; }
    Modular operator-() const { return Modular(-x); }
    Modular operator+(const Modular& p) { return Modular(*this) += p; }
    Modular operator-(const Modular& p) { return Modular(*this) -= p; }
    Modular operator*(const Modular& p) { return Modular(*this) *= p; }
    Modular operator/(const Modular& p) { return Modular(*this) /= p; }
    bool operator==(const Modular& p) { return x == p.x; }
    bool operator!=(const Modular& p) { return x != p.x; }
    friend std::ostream& operator<<(std::ostream& out, const Modular& p) { return out << p.x; }
    friend std::istream& operator>>(std::istream& in, Modular& a) {
        long long t;
        in >> t;
        a = Modular<mod>(t);
        return in;
    }
    Modular Inverse() const {
        int a = x, m = mod, u = 1, v = 0, t;
        while (m > 0) {
            t = a / m;
            std::swap(a -= t * m, m);
            std::swap(u -= t * v, v);
        }
        return Modular(u);
    }
};

const int mod = 998244353;
using mint = Modular<mod>;

class Task {
    std::vector<mint> fact;
    void init(int n) {
        fact.resize(n + 1);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    }
public:
    void solve(std::istream& in, std::ostream& out) {
        using namespace std;
        int n; in >> n;
        vector<int> w(n);
        for (int i = 0; i < n; ++i) in >> w[i];
        int sum = accumulate(w.begin(), w.end(), 0);
        if (sum & 1) {
            out << 0 << '\n';
            return;
        }
        const int MAX = (int) 1e5 + 50;
        vector<vector<mint>> dp(n + 1, vector<mint> (MAX));
        dp[0][0] = 1;
        for (int i = 0; i < n; ++i) {
            for (int j = n; j >= 1; --j) {
                for (int k = j * 100; k >= w[i]; --k) {
                    dp[j][k] += dp[j - 1][k - w[i]];
                }
            }
        }
        init(n);
        mint ans = 0;
        for (int i = 1; i < n; ++i) {
            ans += dp[i][sum / 2] * fact[i] * fact[n - i];
        }
        out << ans << '\n';
    }
};

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Task solver;
    solver.solve(std::cin, std::cout);
    return 0;
}