#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cassert>
#include <map>
#include <numeric>
#include <cstring>
#include <set>
#include <ctime>
#include <queue>
#include <cmath>
#include <iomanip>
#include <iterator>
#include <bitset>
#include <unordered_map>
#include <complex>
#include <unordered_set>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

using namespace std;

clock_t timeStart, timeFinish;

void timeBegin() {
    timeStart = clock();
}

void timeEnd() {
    timeFinish = clock();
}

void timeDuration() {
    timeEnd();
    double time_taken = double(timeFinish - timeStart) / double(CLOCKS_PER_SEC);
    cout << "Time taken by program is : " << fixed << time_taken << setprecision(5);
    cout << " sec " << endl;
}

class InputReader {
public:
    InputReader() {
        input_file = stdin;
        cursor = 0;
        fread(buffer, SIZE, 1, input_file);
    }

    InputReader(const char *file_name) {
        input_file = fopen(file_name, "r");
        cursor = 0;
        fread(buffer, SIZE, 1, input_file);
    }

    inline InputReader &operator>>(int &n) {
        while ((buffer[cursor] < '0' || buffer[cursor] > '9') && buffer[cursor] != '-') {
            advance();
        }
        int sign = 1;
        if (buffer[cursor] == '-') {
            sign = -1;
            advance();
        }
        n = 0;
        while ('0' <= buffer[cursor] && buffer[cursor] <= '9') {
            n = n * 10 + buffer[cursor] - '0';
            advance();
        }
        n *= sign;
        return *this;
    }

private:
    FILE *input_file;
    static const int SIZE = 1 << 17;
    int cursor;
    char buffer[SIZE];

    inline void advance() {
        ++cursor;
        if (cursor == SIZE) {
            cursor = 0;
            fread(buffer, SIZE, 1, input_file);
        }
    }
};

const int MAXN = 100;
const int MAXW = 100;
const int MOD = 998244353;

int v[1 + MAXN], factorial[1 + MAXN];
int dp[2][1 + MAXN][1 + MAXN * MAXW];

void addTo(int &x, int y) {
    x += y;
    if (x >= MOD) {
        x -= MOD;
    }
}

int main() {
    timeBegin();
    //ifstream cin("input.in");
    //ofstream cout("output.out");
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    srand(time(0));
    int n, sum = 0;
    cin >> n;
    dp[0][0][0] = factorial[0] = 1;
    for (int i = 1; i <= n; i++) {
        factorial[i] = 1LL * factorial[i - 1] * i % MOD;
        int now = (i & 1), before = ((i - 1) & 1);
        cin >> v[i];
        sum += v[i];
        for (int j = 0; j <= i; j++) {
            for (int k = 0; k <= sum; k++) {
                dp[now][j][k] = dp[before][j][k];
                if (j > 0 && k >= v[i]) {
                    addTo(dp[now][j][k], dp[before][j - 1][k - v[i]]);
                }
            }
        }
    }
    if (sum % 2 != 0) {
        cout << "0\n";
    } else {
        int answer = 0;
        for (int i = 1; i < n; i++) {
            addTo(answer, 1LL * dp[n & 1][i][sum / 2] * factorial[i] % MOD * factorial[n - i] % MOD);
        }
        cout << answer << "\n";
    }
    return 0;
}







#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
 
#define fr(i, a, b) for (int i=a; i<(b); i++)
#define FOR(i, a) for (int i=0; i<(a); i++)
#define bck(i,a,b) for (int i = (b)-1; i >= a; i--)
#define BACK(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
  
const int M = 1000000007;
const char nl = '\n';
const int MX = 100001;
bool comp(vector<ll>&a, vector<ll>&b){
	return a[1] < b[1] ;
}
vector<int> sieve(int n) {
	vector<bool>prime(n+1, 1) ;
	for (int i=2 ; i*i<n; i+=1) {if (prime[i]) {
		for (int j =2 ; i*j< n; j+=1) prime[i*j] = 0 ; }}prime[1] = 0; prime[0] = 0 ;
	vector<int>v;for (int i = 0 ;i < prime.size(); i+=1) {if (prime[i]) v.pb(i); }return v ;}
 
 
 
void solve(){ 
	string s ; cin >> s; 
	deque<char>t;
	ll count =0 ; 
	for (auto &x: s) {
		if (x=='R') count ++ ;
		else {
			if (count % 2 ==0) t.pb(x);
			else t.push_front(x); 
		}
	} 
	
	vector<char>v;
	if (count % 2==0) {
	while (t.size()!=0) {
		char x = t.front();
		t.pop_front(); 
		if (v.size() == 0) v.pb(x);
		else {
			if (v.back() == x) v.pop_back();
			else v.pb(x); 
		}
	}}
	else {
		while (t.size()!=0) {
		char x = t.back();
		t.pop_back(); 
			if (v.size() == 0) v.pb(x);
			else {
			if (v.back() == x) v.pop_back();
			else v.pb(x); 
		}
		}
	}
	for(auto x: v) cout << x ;
		cout << nl; 
}
 
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t; 
	 t=1 ;
	 // cin >> t; 
	
	int i =1  ;
	while (t--) {
		solve();
		i+=1 ;
	}
	return 0 ; 
	
}