	#include<bits/stdc++.h>
	using namespace std;
	#define N 200005
	char s[N];int l,i,st[N],hd;
	int main(){
		scanf("%d%s",&l,s+1);
		for(i=1;i<=l;++i){
			st[++hd]=s[i];
			while(hd>2&&st[hd-2]=='f'&&st[hd-1]=='o'&&st[hd]=='x')hd-=3;
		}
		cout<<hd;
	}
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define debugbit(x, n) cerr << #x << " = " << bitset<n>(x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define debugbit(x, n)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long
//using mint = atcoder::modint;

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::string s){
    if (s.size() < 3) {
        cout << s.size() << endl;
        return;
    }
    deque<char> queue;
    rep(i,0,N) queue.push_back(s[i]);
    auto itr = queue.begin();
    int cnt = 0;
    while (!queue.empty() && itr != queue.end()) {
        auto itr2 = itr+1;
        if (itr2 == queue.end()) break;
        auto itr3 = itr+2;
        if (itr3 == queue.end()) break;
        if (*itr == 'f' && *itr2 == 'o' && *itr3 == 'x') {
            ++cnt;
            itr = queue.erase(itr);
            itr = queue.erase(itr);
            auto tmp = queue.erase(itr);
            if (queue.size() < 3) break;
            if (tmp == queue.end()) {
                itr = queue.end() - 3;
            } else if (tmp == queue.begin() || (tmp-1) == queue.begin() || (tmp-2) == queue.begin()) {
                itr = queue.begin();
            } else {
                itr = tmp-2;
            }
        } else {
            itr++;
        }
    }
    cout << s.size() - 3 * cnt << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::string s;
    std::cin >> s;
    solve(N, s);
    return 0;
}
