#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
    long n, temp = 0;
    string s;
    stack<char> st;
    cin >> n >> s;
    if(n >= 3) {
        st.push(s.at(0));
        st.push(s.at(1));
        rep(i, n - 2) {
            if(st.size() < 2) {
                st.push(s.at(i + 2));
                continue;
            }
            char a = st.top();
            st.pop();
            char b = st.top();
            st.pop();
            if(b == 'f' && a == 'o' && s.at(i + 2) == 'x') {
                temp += 3;
            } else {
                st.push(b);
                st.push(a);
                st.push(s.at(i + 2));
            }
        }
    }
    long ans = n - temp;
    cout << ans << endl;
}
#include <iostream>
#include <vector>
#include <time.h>
#include <math.h>
#include <algorithm>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii > vii;
typedef vector<vector<ll> > vvi;
typedef vector<vvi > vvvi;
typedef vector<vector<pair<ll, ll> > > vvii;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,s,e) for(ll i=(s);i<(e);++i)
#define repr(i,s,e) for(ll i=(e);i>(s);--i)
#define io ios::sync_with_stdio(false)
#define prv(v)                                                             \
	do                                                                      \
	{                                                                       \
		for(auto it = (v).begin(); it != (v).end(); ++it) cerr << *it << " "; \
		cerr << endl; \
	} while (0);
#define prm(m)                                           \
	do                                                     \
	{                                                      \
		for (auto it = (m).begin(); it != (m).end(); ++it)   \
			cerr << it->first << " -> " << it->second << endl; \
	} while (0);

const ll MOD = 1e9+7;
const ll INF = 1e14;
const ll TE3 = 1005;
const ll TE5 = 300005;
const string YN[2] = {"NO", "YES"};

using namespace std;

int main()
{
	io;
	ll n;
	string s;
	cin >> n >> s;
	stack<char> u;
	rep(i,0,n) {
		char c = s[i];
		if(u.size()<2) {
			u.push(c);
		} else {
			if(c!='x') {
				u.push(c);
			} else {
				char b = u.top();
				u.pop();
				char a = u.top();
				u.pop();
				if(a == 'f' && b == 'o') {

				} else {
					u.push(a);
					u.push(b);
					u.push(c);
				}
			}
		}
	}
	cout << u.size() << endl;
	return 0;
}
