n = int(input()) S = input() L = [ord(s)-ord("a") for s in S] mod = 998244353 dp = [[0,0],[0,0]] dp[1][0] = 1 for l in L: ndp = [[0,0],[0,0]] for i in range(26): if i: ndp[0][0] += dp[0][0] ndp[0][0] %= mod ndp[0][1] += dp[0][1] ndp[0][1] %= mod else: ndp[0][1] += dp[0][0] ndp[0][1] %= mod if i < l: if i: ndp[0][0] += dp[1][0] ndp[0][0] %= mod ndp[0][1] += dp[1][1] ndp[0][1] %= mod else: ndp[0][1] += dp[1][0] ndp[0][1] %= mod elif i == l: if i: ndp[1][0] += dp[1][0] ndp[1][0] %= mod ndp[1][1] += dp[1][1] ndp[1][1] %= mod else: ndp[1][1] += dp[1][0] ndp[1][1] %= mod dp = ndp print(dp[0][1])