#include "bits/stdc++.h"
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vll=vector<ll>;
using vvll=vector<vll>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define pb push_back
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//const int INF = 1123456789;
//const int mod = 1e9+7;
const int mod=998244353;

ll kaijo[105];
void cal(){
    ll res=1;
    for(int i=1;i<105;i++){
        (res*=i)%=mod;
        kaijo[i]=res;
    }
}
int main(){
    cal();
    int n; cin>>n;
    ll sum=0;
    vll w(n); rep(i,n) {cin>>w[i]; sum+=w[i];}
    if(sum%2){cout<<0<<endl; return 0;}
    vector<vvll> dp(n+1,vvll(10001,vll(n+1)));
    dp[0][0][0]=1;
    rep(i,n){
        rep(j,10001)rep(k,n){
            (dp[i+1][j][k]+=dp[i][j][k])%=mod;
            if(j+w[i]<=10000)(dp[i+1][j+w[i]][k+1]+=dp[i][j][k])%=mod;
        }
    }
    sum/=2;
    ll ans=0;
    rep(i,n+1){
        (ans+=dp[n][sum][i]*kaijo[i]%mod*kaijo[n-i])%=mod;
    }
    cout<<ans<<endl;
}

#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#include <unordered_map>
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for(ll i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define spre cout<<fixed<<setprecision(15);
typedef long long int ll;
using namespace std;
//ll mod=67280421310721;
ll mod=998244353;
ll INF=1e9;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("INPUT.txt", "r", stdin);
	freopen("OUTPUT.txt", "w", stdout);
	#endif
	int test=1;
	// cin>>test;
	while(test--)
	{
		ll n;
		cin>>n;
		vector<ll> ans;
		for(ll i=1;i*i<=n;i++)
		{
			if((n%i)==0)
			{
				ans.pb(i);
				if((i*i)!=n)
				{
					ans.pb(n/i);
				}
			}
		}
		sort(ans.begin(),ans.end());
		FOR(i,0,ans.size())
		cout<<ans[i]<<'\n';
	}
	return 0;
}