#include <bits/stdc++.h>
//#include <bits/extc++.h>
//#include <immintrin.h>

using namespace std;

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")


template<typename T>
istream &operator>>(istream &in, vector<T> &a) {
    for (auto &i : a)
        in >> i;
    return in;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &a) {
    for (auto &i : a) {
        out << i << " ";
    }
    return out;
}

template<typename T, typename D>
istream &operator>>(istream &in, pair<T, D> &a) {
    in >> a.first >> a.second;
    return in;
}

template<typename T, typename D>
ostream &operator<<(ostream &out, const pair<T, D> &a) {
    out << a.first << " " << a.second;
    return out;
}

struct LogOutput {
    template<typename T>
    LogOutput &operator<<(const T &x) {
#ifdef DIVAN
        cout << x;
#endif
        return *this;
    }
} dout, fout;

typedef long long ll;
typedef unsigned long long ull;
typedef double dl;
typedef complex<double> cd;

#define nl '\n'
#define elif else if
#define all(_v) _v.begin(), _v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define sqr(_v) ((_v) * (_v))
#define eb emplace_back
#define pb push_back
#define mod(x, m) ((x) >= 0 ? ((x) % m) : ((((x) % m) + m) % m))
#define minq(x, y) x = min((x), (y))
#define maxq(x, y) x = max(x, (y))
#define forn(i, n) for (int i = 0; i < (n); ++i)

#define vpi vector <pair <int, int, int>>
#define vi vector<int>
#define pi pair <int, int>
#define ti tuple <int, int, int>


const ll INFL = 9187201950435737471;
const ll nINFL = -9187201950435737472;
const int INF = 2139062143;
const int nINF = -2139062144;
const ull ULINF = numeric_limits<ull>::max();
const long double PI = acos(-1);
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd(seed);

inline void IO() {
#ifdef DIVAN
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#else
    //    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
}

#define int ll

const int MOD = 998244353;

const int MAXN = 100 + 15;
const int MAXE = 1e4 + 15;

int dp[MAXN][MAXE];
int ndp[MAXN][MAXE];

void Add(int &a, int b) {
    a = (a + b) % MOD;
}

int Factorial(int x) {
    if (x == 0) {
        return 1;
    }
    return (Factorial(x - 1) * x) % MOD;
}

void Solve() {
    int n;
    cin >> n;
    vi a(n);
    cin >> a;
    int need = 0;
    for (auto u : a) {
        need += u;
    }
    if (need & 1ll) {
        cout << "0";
        return;
    }
    need >>= 1ll;
    dp[0][0] = 1;
    for (auto u : a) {
        memcpy(ndp, dp, sizeof(dp));
        forn(i, MAXN) {
            forn(j, MAXE) {
                if (dp[i][j]) {
                    Add(ndp[i + 1][j + u], dp[i][j]);
                }
            }
        }
        memcpy(dp, ndp, sizeof(dp));
    }
    int sum = 0;
    forn(i, MAXN) {
        if (dp[i][need] != 0) {
            Add(sum, (dp[i][need] * ((Factorial(i) * Factorial(n - i)) % MOD)) % MOD);
        }
    }
    cout << sum;
}

signed main() {
    auto startTime = chrono::high_resolution_clock::now();
    IO();
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; ++i) {
//        cout << "Case #" << i << ": ";
        Solve();
    }
    auto endTime = chrono::high_resolution_clock::now();
    chrono::duration<long double> duration = endTime - startTime;
    cout << setprecision(6) << fixed;
    fout << '\n' << "Time: " << duration.count();
    return 0;
}

#include <cctype>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <ios>
#include <iostream>
#include <iterator>
#include <string_view>
#include <utility>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <climits>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <regex>
#include <set>
#include <bitset>
#include <list>

const int64_t infl = 1LL << 60;
const int64_t cc = pow(10, 9) + 7;
bool sort_pair(std::pair<int64_t, char> origin,std::pair<int64_t, int64_t> another) {return origin.first < another.first; }
template <typename T> bool chmin(T &a, const T& b) {if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b;return true; } return false; }


int main()
{
    int64_t q,k,n,s,h,w,d,e,x;
    std::cin>> n;

    std::string str;
    std::vector< int64_t > list( n );
    int64_t dp[2][n+1];
    k = 1;
    
    for( int i = 0; i < n; i++ )
    {
        std::cin>> str;

        if( str == "AND" )
        {
            list[i] = 1;
        }
        else
        {
            list[i] = 0;
        }
    }


    dp[0][0] = 1;//False
    dp[1][0] = 1;//True
    
    for( int i = 0; i < n; i++ )
    {
        if( list[i] == 1 )//And
        {
            dp[0][i+1] = dp[0][i] * 2 + dp[1][i];
            dp[1][i+1] = dp[1][i];
        }
        else
        {
            dp[0][i+1] = dp[0][i];
            dp[1][i+1] = dp[1][i] * 2 + dp[0][i];
        }
    }

    std::cout<< dp[1][n];
}


