#int(input()) #map(int, input().split()) #list(map(int, input().split())) N = int(input()) S = input() mod = 998244353 t = 1 m = N fac = [1] * (m+1) facinv = [1] * (m+1) for i in range(1, m+1): fac[i] = (fac[i-1] * i) % mod facinv[i] = (facinv[i-1] * pow(i, mod-2, mod)) % mod def nCk(n, k): return (fac[n] * facinv[k] * facinv[n-k]) % mod from collections import Counter c = Counter() a = S.count("A") + S.count("B") print(nCk(N, a))