#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define FOR(i, m, n) for (ll i(m); i < n; i++)
#define DWN(i, m, n) for (ll i(m); i >= n; i--)
#define REP(i, n) FOR(i, 0, n)
#define DW(i, n) DWN(i, n, 0)
#define F(n) REP(i, n)
#define FF(n) REP(j, n)
#define D(n) DW(i, n)
#define DD(n) DW(j, n)
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using tll = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using vtll = vector<tll>;
using gr = vector<vll>;
using wgr = vector<vpll>;
void add_edge(gr&g,ll x, ll y){ g[x].pb(y);g[y].pb(x); }
void add_edge(wgr&g,ll x, ll y, ll z){ g[x].eb(y,z);g[y].eb(x,z); }
template<typename T,typename U>
ostream& operator<<(ostream& os, const pair<T,U>& p) { 
    cerr << ' ' <<  p.x << ',' << p.y; return os; }
template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) { 
    for(auto x: v) os << ' ' <<  x; return os; }
template <typename T> 
ostream& operator<<(ostream& os, const set<T>& v) { 
    for(auto x: v) os << ' ' <<  x; return os; }
template<typename T,typename U>
ostream& operator<<(ostream& os, const map<T,U>& v) { 
    for(auto x: v) os << ' ' <<  x; return os; }
struct d_ {
    template<typename T> d_& operator,(const T& x) {
        cerr << ' ' <<  x; return *this;}
} d_t;
#define dbg(args ...) { d_t,"|",__LINE__,"|",":",args,"\n"; }
#define deb(X ...) dbg(#X, "=", X);
#define EPS (1e-10)
#define INF (1LL<<61)
#define YES(x) cout << (x ? "YES" : "NO") << endl;
#define CL(A,I) (memset(A,I,sizeof(A)))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

const ll MOD = 998244353;
ll mod(ll a, ll b=MOD) {
  return ((a%b)+b)%b;
}
ll extended_euclid(ll a,ll b,ll &x,ll &y) {
    if (a == 0) { x = 0; y = 1; return b;}
    ll x1, y1; ll d = extended_euclid(b%a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
ll mod_inverse(ll a, ll n=MOD) {
  ll x, y;
  ll d = extended_euclid(a, n, x, y);
  if (d > 1) return -1;
  return mod(x,n);
}
struct Mt {
    ll x = 0;
    Mt(){}
    Mt(ll y):x(mod(y)){}
    bool operator==(Mt &y){return x==y.x;}
    Mt operator+(Mt y){return mod(x+y.x);}
    Mt operator-(){return mod(-x);}
    Mt operator-(Mt y){return mod(x-y.x);}
    Mt operator*(Mt y){return mod(x*y.x);}
    Mt operator/(Mt y){return mod(x*mod_inverse(y.x));}
    Mt operator+=(Mt y){return x=(*this+y).x;}
    Mt operator-=(Mt y){return x=(*this-y).x;}
    Mt operator*=(Mt y){return x=(*this*y).x;}
    Mt operator/=(Mt y){return x=(*this/y).x;}
    Mt pow(ll p) {
        Mt ret=1, z=x;
        while(p) {
            if (p&1) ret*=z;
            z*=z; p/=2;
        }
        return ret;
    }
    Mt operator^(Mt y){return this->pow(y.x);}
};
ostream& operator<<(ostream& os, const Mt&m){
    os << m.x; return os;
}

const ll N = 5e3+7;
Mt pw[N][N];

int main(void) {
    ios_base::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    F(m+1) pw[i][0] = 1;
    FOR(i,1,m+1) FOR(j,1,n+1) {
        pw[i][j] = pw[i][j-1] * i;
    }
    Mt ret = Mt(n) * pw[m][n];
    FOR(x,1,m+1) FOR(d,1,n+1) {
        Mt cur = pw[m-x][d-1] * pw[m][n-d-1];
        ret -= cur * (n-d);
    }
    cout << ret << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define sync std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define int long long
#define loop(i,n)           for(int i=0;i<n;i++)
#define FOR(i,a,b,c)        for(int i=a;i<=b;i=i+c)
#define RFOR(i,a,b,c)       for(int i=a;i>=b;i=i-c)

typedef long long ll;
typedef long double ld;
typedef pair<int, int>  pii;
typedef vector<int> vi;
typedef vector <pair<int,int>> vp;

#define     deb(x)          cout<<#x<<" = "<<x<<endl
#define     all(x)          (x).begin(),(x).end()
#define     reset(a)        memset(a,0,sizeof(a))
#define     pb              push_back
#define     pf              push_front
#define     pob	            pop_back
#define     pof             pop_front
#define     ins             insert
#define     F               first
#define     S               second
#define     mkp             make_pair
#define     mkt             make_tuple
#define     bitcount(x)     __builtin_popcountll(x)
#define     gcd(a,b)        (__gcd(a,b))
#define     lcm(a,b)        ((a*b)/gcd(a,b))

#define PI 3.1415926535897932384626

const int mod = 998244353  ;//1e9+7;
const int N=2e5+5;


//============


void solve()
{
	int n,ans=0;
	string s,t;
	cin>>n>>s;
	char a,b,c;
	
	stack<char> stk;
	
	for(auto et: s)
	{
		stk.push(et);
		if(et=='x' && stk.size()>2)
		{
			a=stk.top();	stk.pop();
			b=stk.top();	stk.pop();
			c=stk.top();	stk.pop();
			if(a=='x' && b=='o' && c=='f')
				ans++;
			else
			{
				stk.push(c);
				stk.push(b);
				stk.push(a);
			}
		}
	}
	cout<<n-3*ans;
	
}

int32_t main() 
{
	sync;
	
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

	int t=1;
	//cin>>t;
	FOR(i,1,t,1)
	{
		//cout<<"Case #"<<i<<": "<<;  
		solve();
		cout<<endl;
	}
}