#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    stack<char> s;
    int cnt = 0;
    for(int i = 0; i < N; i++){
        if(S[i] == 'f') s.push('f');
        else if(S[i] == 'o'){
            if(s.empty() || s.top() != 'f'){
                while(!s.empty()) s.pop();
            }
            else if(s.top() == 'f') s.push('o');
        }
        else if(S[i] == 'x'){
            if(s.empty() || s.top() != 'o'){
                while(!s.empty()) s.pop();
            }
            else if(s.top() == 'o'){
                s.pop();
                s.pop();
                cnt += 3;
            }
        }
        else{
            while(!s.empty()) s.pop();
        }
    }
    cout << N - cnt << endl;
}
#include <bits/stdc++.h> 
#include <functional> 
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <string.h>
using namespace std;
typedef pair<int,int> pii;
#define fast   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y               "YES"
#define N               "NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;
//priority_queue<pii, vector<pii>, greater<pii> > pq;



inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
int toDigit(char ch) 
{ 
    return (ch - '0'); 
} 

long modPow(long a, long x, long p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}
 
long modInverse(long a, long p) {
    
    return modPow(a, p-2, p);
}
 
int nCrModpDP(int n, int r, int p) 
{ 
    int C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (int i = 1; i <= n; i++) 
    { 
      
        for (int j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
int nCrModpLucas(int n, int r, int p) 
{ 
  if (r==0) 
      return 1; 
   int ni = n%p, ri = r%p; 
  
   
   return (nCrModpLucas(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p;   
} 
 
ll fact(int f){
    ll ans=1;
    for(int i=1;i<=f;++i){
        ans=mul(i,ans);
    }
    return ans;
}
void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    stack<int> f;
    stack<int> o;
    stack<int> x;
    int a=0;
    int fi,oi,xi;
     fi=oi=xi=0;
    rep(i,n){
        if(s[i]=='f') f.push(i-oi);
        else if(s[i]=='o') o.push(i-oi);
        else if(s[i]=='x'){
            x.push(i-oi);
            if(!f.empty()&&!o.empty()){
                if(f.top()+1==o.top()&&o.top()+1==x.top()){
                a++;
                f.pop();o.pop();x.pop();
                oi+=3;
                }
            }
        }
    }
    cout<<n-a*3<<'\n';
}
int main(){
    int t=1;
   
    while(t--) solve();
return 0;
}