""" dp[i][密着][aがあるか] = ? """ import sys from sys import stdin N = int(stdin.readline()) SI = list(stdin.readline()[:-1]) S = [ord(c)-ord("a") for c in SI] #print (S) mod = 998244353 dp = [[0,0],[0,0]] dp[1][0] = 1 for i in range(N): ndp = [[0,0],[0,0]] for c in range(26): for linka in range(2): for isa in range(2): if linka == 1 and S[i] < c: continue elif isa == 1 and c == 0: continue if c == 0: if S[i] == 0: ndp[1][1] += dp[linka][isa] else: ndp[0][1] += dp[linka][isa] elif linka == 1: if S[i] == c: ndp[1][isa] += dp[linka][isa] else: ndp[0][isa] += dp[linka][isa] else: ndp[linka][isa] += dp[linka][isa] for x in range(2): for y in range(2): ndp[x][y] %= mod dp = ndp #print (dp) #print (dp) print (dp[0][1] % mod)