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

#define all(v) v.begin(), v.end()

int main(void){
    int n; string s1, s2 = "";
    cin >> n >> s1;
    if (n < 3){cout << n << endl; return 0;}

    s2 = s1.substr(n - 2, 2);
    s1 = s1.substr(0, n - 2);
    reverse(all(s2));

    auto size = [&]()->int{return s1.length() + s2.length();};

    auto dfs = [&](auto dfs, int i1, int i2)->void{
        int n1 = s1.length(), n2 = s2.length();
        if (n1 < i1 || n2 < i2) return;
        string ss1 = s1.substr(n1 - i1, i1), ss2 = s2.substr(n2 - i2, i2);
        reverse(all(ss2));
        if (ss1 + ss2 == "fox"){
            for (int i = 0; i < i1; ++i) s1.pop_back();
            for (int i = 0; i < i2; ++i) s2.pop_back();
            dfs(dfs, 1, 2);
            dfs(dfs, 2, 1);
        }
    };

    while (!s1.empty()){
        dfs(dfs, 1, 2);
        dfs(dfs, 2, 1);
        if (!s1.empty()) s2.push_back(s1.back()), s1.pop_back();
    }

    cout << size() << endl;
    return 0;
}
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define fill(arr,c) memset(arr,c,sizeof(arr))
#define perm(r) next_permutation(all(r))
//it gives bool value ans permute the string lexoggraphically
#define sortdesc greater<int>()
#define ll long long int 
//std::setfill('0') << std::setw(5) << 25; it adds leaing zeroes;
#define f(i,a) for(int i=0;i<a;i++)
#define fo(i,a) for(int i=1;i<=a;i++)
#define foo(i,x,n,c) for(ll i=x;i<n;i+=c)
#define foi(i,x,n,c) for(ll i=x;i>=n;i+=c)
#define fauto(i,m) for(auto i:m)
#define forall(a) for( auto itr=a.begin();itr!=a.end();itr++)
#define ld long double
#define in push_back
#define mll map<ll,ll>
#define mcl map<char,ll>
#define msl map<string,ll>
#define vi vector<int >
#define vl vector<ll >
#define vp vector< pair<int,int> >
#define vs vector <string> 
#define vc vector <char> 
#define o(a) cout<<a
#define os(a) cout<<a<<" "
#define en cout<<"\n";
#define testcase ll t ;cin>>t; while(t--)
#define ff first
#define ss second
#define pl pair<ll,ll>
#define pi pair<int,int>
#define all(a) (a).begin(), (a).end()

#define sz(a)  (a).size()
#define prec(n) fixed<<setprecision(n)
#define mp make_pair
#define bitcount  __builtin_popcountll
#define imin o("imin");en;
using namespace std;
bool comp(const pair<int,int> &a , const pair<int,int> &b){
    if(a.first == b.first)  return a.second < b.second;
     return a.first < b.first;
}
bool comps(const pair<int,int> &a , const pair<int,int> &b){
    if(a.second == b.second)  return a.first< b.first;
     return a.second < b.second;
}
//ll pi=acos(0.0)*2;
void fastio()
{
    	ios::sync_with_stdio(0);
cin.tie(0);

}
void inout()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);

     freopen("output.txt", "w", stdout);
     #endif
}
ll ans=0;
ll chk(ll i,ll gap,ll n,string s)
{
	string f;
	if(gap==0)
	{
	if(s[i]=='f' && s[i+1]=='o' && s[i+2]=='x')	
	{
		ans+=3;
	//	os(i);os(0);en;
			ll x=chk(i,gap+3,n,s);
			
	}
//	os(f);
}
	else
	{
		if(i-1>=0 && i+2<n)
		{
		
	if(s[i-1]=='f' && s[i+gap]=='o' && s[i+1+gap]=='x')		
	{
			ans+=3;
		//		os(i);os(1);en;
		ll x=chk(i-1,gap+3,n,s);
	}

//	os(f);
	
}
else 	if(i-2>=0 && i+1<n)
		{
		
		
	if(s[i-2]=='f' && s[i-1]=='o' && s[i+gap]=='x')		
{
//	os(i);os(2);en;
			ans+=3;
		ll x=chk(i-2,gap+3,n,s);
	}

//os(f);

}
	return 0;
	}

//	os(f);en;
	return 0;
}

int main()
{
fastio();
ll n;
cin>>n;
string s;
cin>>s;
stack<char> bag;
ll ans=0;
char a,b,c;
f(i,n)
{
	bag.push(s[i]);
	if(sz(bag)>=3)
	{
		a=bag.top();
		bag.pop();
		b=bag.top();
		bag.pop();
		c=bag.top();
		bag.pop();
		if(a=='x' && b=='o' && c=='f')
		ans++;
		else
		{
			bag.push(c);bag.push(b);bag.push(a);
		}
	}
	
}
o(n-3*ans);
en;


return 0;
}
