#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,7)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N; cin >> N;
  string S; cin >> S;

  ll cnt = 0;
  stack<char> st;
  rep(i,N) {
    if (S[i]=='x'&&st.size()>=2) {
      char co = st.top(); st.pop();
      char cf = st.top(); st.pop();
      if (cf=='f'&&co=='o') cnt++;
      else { st.push(cf); st.push(co); st.push(S[i]); }
    }
    else st.push(S[i]);
  }

  ll result = N - cnt*3;
  cout << result << endl;
  return 0;
}
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define MO 1000000007
#define mem(a,s) memset(a,s,sizeof(a))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define lop(i,s,e) for(int i=s;i<e;i++)
#define lopi(i,s,e) for(int i=s;i>=e;i--)
#define prina(a,n) for(int i=0;i<=n;i++)cout<<a[i]<<" ";cout<<endl; 
#define prin2da(a,n,m) lop(i,1,n){lop(j,1,m)cout<<a[i][j]<<" ";cout<<endl;}
#define atout(v) for(auto x:v) cout<<x<<" ";cout<<endl;
#define atin(v) for(auto &x:v) cin>>x;
#define vl vector<ll >
#define vi vector<int >
#define lb lower_bound
#define ub upper_bound
#define sort(a) sort(a.begin(),a.end())  
#define mp make_pair
#define all(v) v.begin(),v.end() 
#define pll pair<ll,ll>
using namespace std;

void solve() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	stack<char> st;
	int ans=0;
	for(int i=0 ; i<n ; i++) {
		if(s[i]=='x' and !st.empty() and st.top()=='o') {
			st.pop();
			if(!st.empty() and st.top()=='f') {
				st.pop();
				ans+=3;
			}
			else st.push('o');
		}
		else st.push(s[i]);
	}
	cout<<n-ans<<endl;
}

int main() {
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	ll t=1;
	//cin>>t;
	while(t--) {
		solve();
	}

	return 0;
}