#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++ i)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

int N, a[105];
LL d[105], dp[10005][105];

int main()
{
    scanf("%d", &N);
    rep(i, N) scanf("%d", &a[i]);

    d[0] = 1;
    rep1(i, N) d[i] = d[i - 1] * i % MOD;

    dp[0][0] = 1;
    int sum = 0;
    rep(i, N) {
        sum += a[i];
        for (int j = sum; j >= a[i]; -- j) for (int k = i + 1; k >= 1; -- k) {
            dp[j][k] += dp[j - a[i]][k - 1];
            if (dp[j][k] >= MOD) dp[j][k] -= MOD;
        }
    }

    if (sum & 1) {
        printf("0\n"); return 0;
    }
    
    LL ret = 0;
    rep(i, N + 1) if (dp[sum / 2][i]) {
        (ret += d[i] * d[N - i] % MOD * dp[sum / 2][i]) %= MOD;
    }

    printf("%lld\n", ret);

    return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    //*
    int N;
    cin>>N;
    vector<int> W(N);
    for (int &w: W)
        cin>>w;
    /*/
    int N = 100;
    vector<int> W(N, 100);
    //*/

    long long M = 998244353;
    vector<vector<long long>> T(N+1, vector<long long>(N*100+1));
    T[0][0] = 1;
    for (int i=0; i<N; i++)
        for (int j=i; j>=0; j--)
            for (int k=0; k<=i*100; k++)
                (T[j+1][k+W[i]] += T[j][k]) %= M;

    //for (int i=0; i<10; i++)
    //{
    //    for (int j=0; j<10; j++)
    //        cout<<" "<<T[i][j];
    //    cout<<endl;
    //}

    int s = 0;
    for (int w: W)
        s += w;
    if (s%2!=0)
    {
        cout<<0<<endl;
        return 0;
    }
    s /= 2;

    vector<long long> F(N+1);
    F[0] = 1;
    for (int i=1; i<=N; i++)
        F[i] = F[i-1]*i%M;

    long long ans = 0;
    for (int i=1; i<=N; i++)
        (ans += T[i][s]*F[i]%M*F[N-i]) %= M;
    cout<<ans<<endl;
}
