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

#define MAX( a , b )    ( a > b ) ? a : b
#define MIN( a , b )    ( a < b ) ? a : b

using ull = unsigned long long;
using ll = long long;
using ul = unsigned long;

ull Euclidean(ull a, ull b){
    if((a % b) == 0)
        return b;
    else
        return Euclidean(b , (a % b));
}


int main(){
    ull N;
    ull result = 1;
    ull sub[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
    bool count[15] = {false};
    ull c;
    ull z;
    bool r = false;

    cin >> N;
    vector<ull> x(N,0);
    for (ull i = 0; i < N; i++)
        cin >> x[i];

    for (ull j = 0; j < 15; j++){
        result *= sub[j];
    }  

    for (ull i = 0; i < 32768; i++){
        z = i;
        c = 1;
        r = true;
        for (ull j = 0; j < 15; j++){
            if((z % 2) == 1)
                c *= sub[j];
            z /= 2;
        }
        for(ull k = 0; k < N; k++){
            if((Euclidean(MAX(c , x[k]) , MIN(c , x[k]))) == 1){
                r = false;
                break;
            }
        }
        if(r)
            result = MIN(result , c);
    }
    
    cout << result << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }

const int P = 998244353;
int n,a[105];

inline void upd(int &x,int v){ x = (x+v>=P)?(x+v-P):(x+v); }

int f[105][10005];
int s,fac[105],l;

inline void add(int n,int x){
	register int i,j,v;
	for (i = n; i ; --i) for (j = x; j <= s; ++j) upd(f[i][j],f[i-1][j-x]);
}

int main(){
	int i;
	cin >> n;
	for (fac[0] = i = 1; i <= 100; ++i) fac[i] = fac[i-1] * 1ll * i % P;
	for (i = 1; i <= n; ++i) cin >> a[i],s += a[i]; l = s/2;
	if (s % 2 == 1){ cout << 0 << '\n'; return 0; }
	f[0][0] = 1;
	for (i = 1; i <= n; ++i) add(i,a[i]);
	long long ans = 0;
	for (i = 0; i <= n; ++i){
		if (f[i][s / 2])
			ans = (ans + 1ll * f[i][s/2] * fac[i] % P * fac[n-i] % P) % P;
	}
	cout << ans << '\n'; 
	return 0;
}