// kでループ、ペアを全探索 (その2) #include #define FOR(i,k,n) for(int i = (k);i < (n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(x) begin(x),end(x) using namespace std; using vecint = vector; using ll = int64_t; using vecll = vector; constexpr ll MOD = 998244353; constexpr ll MAX_F = 600000; // a^-1 mod p ll inv(ll a,ll p){ return ( a == 1 ? 1 : (1 - p*inv(p%a,a)) / a + p ); } int main() { vecll fact(MAX_F+1), finv(MAX_F+1); fact[0] = 1; REP(i,MAX_F) { fact[i+1] = fact[i] * (i+1) % MOD; } finv[MAX_F] = inv(fact[MAX_F], MOD); REP(ri,MAX_F) { int i = MAX_F - ri; finv[i-1] = finv[i] * i % MOD; } auto comb = [&] (ll n, ll k) { return fact[n] * finv[k] % MOD * finv[n-k] % MOD; }; ll n; cin>>n; string s; cin>>s; ll ans = 0; REP(k,n-1) { ll tmp = 0; FOR(span,k,n-1){ ll c = comb(span, k); REP(i,n) { if (i+span+1 >= n) break; if (s[i] != 'i' || s[i+span+1] != 'n') { continue; } tmp += c; tmp %= MOD; } } ans ^= tmp; } cout<