#include using namespace std; constexpr int mod = 998244353; long long fac[2000005], finv[2000005], inv[2000005]; void COMinit() { fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1; for (int i = 2; i < 2000005; i++) { fac[i] = fac[i - 1] * i % mod; inv[i] = mod - inv[mod % i] * (mod / i) % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % mod) % mod; } int main() { int N; string S; cin >> N >> S; COMinit(); int a = 0,c = 0; for(int i = 0; i < N; i++) { if(S[i] == 'A' || S[i] == 'B') { a++; } else { c++; } } cout << COM(N,a) << endl; }