/*_____________________
	|Author : canhnam357|
	|___________________|
*/
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <string> vS;
typedef vector <vector <int>> vvi;
typedef vector <vll> vvll;
typedef map<int, int> mi;
typedef map<string, int> ms;
typedef map<char, int> mc;
typedef map <int, bool> mb;
typedef map<ll, ll> mll;
typedef unordered_map<int, int> umi;
typedef unordered_map<string, int> ums;
typedef unordered_map<char, int> umc;
typedef unordered_map <int, bool> umb;
typedef unordered_map<ll, ll> umll;
typedef string S;
typedef vector <ld> vld;
typedef vector <bool> vb;
typedef pair <int, int> pii;
typedef pair<ll, ll> pll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
#define FOR(i,N) for(ll i = 0 ; i < N;i++)
#define eFOR(i,a,b) for(ll i = a; i <=b;i++)
#define dFOR(i,N) for(ll i = N - 1; i>=0;i--)
#define edFOR(i,b,a) for(ll i = b ; i >=a;i--)
#define all(x) x.begin(),x.end()
#define SORT(x) sort(all(x))
#define RSORT(x) sort(x.rbegin(),x.rend())
#define UNQ(x)  unique(all(x))
#define mine(x) min_element(all(x))
#define maxe(x) max_element(all(x))
#define pb push_back
#define PI 3.141592653589793
#define FIX cout << fixed << setprecision(15);
const ll mod = 998244353;
int CASE = 1;
const int mxn = 2e4 + 1;
const ll INF = 1e18;
int __gcd(int a, int b)
{
	return !b ? a : __gcd(b, a % b);
}
ll sum(ll n)
{
	return (n * (n + 1) / 2) % mod;
}
void solve()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	string t = "";
	for (char c : s)
	{
		t.push_back(c);
		if (t.length() > 2 && t.substr(t.length() - 3) == "fox")
		{
			t.pop_back();
			t.pop_back();
			t.pop_back();
		}
	}
	cout << t.length();
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T = 1;
	while (T--)
	{
		solve();
	}
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;cin >>n;
    string s;cin >>s;
    vector<string>tmp;
    ll ans=0;
    for (int i = 0; i < n;) {
        if(s[i]!='f' and s[i]!='o' and s[i]!='x'){
            tmp.clear();
            i++;
        }
        else if(s.substr(i,3)=="fox"){
            ans+=3;
            i+=3;
        }
        else if(s.substr(i,2)=="fo"){
            tmp.push_back("fo");
            i+=2;
        }
        else if(s[i]=='f'){
            tmp.push_back("f");
            i++;
        }
        else if(s.substr(i,2)=="ox"){
            if(tmp.empty()){
                i+=2;
            }
            else{
                if(tmp.back()=="f"){
                    ans+=3;
                    i+=2;
                    tmp.pop_back();
                }
                else{
                    tmp.clear();
                    i+=2;
                }
            }
        }
        else if(s[i]=='x'){
            if(tmp.empty()){
                i++;
            }
            else{
                if(tmp.back()=="fo") {
                    ans += 3;
                    i++;
                    tmp.pop_back();
                }
                else{
                    tmp.clear();
                    i++;
                }
            }
        }
        else if(s[i]=='o'){
            if(tmp.empty()) {
                i++;
            }
            else if(tmp.back()=="f"){
                tmp.pop_back();
                tmp.push_back("fo");
                i++;
            }
            else {
                tmp.clear();
                i++;
            }
        }
        else {
            tmp.clear();
            i++;
        }
    }
    cout <<n-ans<<"\n";
    return 0;
}

