#include const int Mod = 998244353; long long div_mod(long long x, long long y, long long z) { if (x % y == 0) return x / y; else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y; } int main() { int N; char S[100001]; scanf("%d", &N); scanf("%s", S); int i, count[3] = {}; long long fact[100001]; for (i = 0; S[i] != 0; i++) count[S[i] - 'A']++; for (i = 1, fact[0] = 1; i <= N; i++) fact[i] = fact[i-1] * i % Mod; if (count[0] == 0 || count[1] == 0 || count[2] == 0) printf("1\n"); else printf("%lld\n", (div_mod(div_mod(div_mod(fact[N], fact[count[0]], Mod), fact[count[1]], Mod), fact[count[2]], Mod) + Mod - N) % Mod); fflush(stdout); return 0; }