#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;

#define REP(i,b,e) for(int i=b; i<e; i++)
#define PRINT(vec) {printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");}
#define fi first
#define se second

const int MOD = 1e9+7;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n;
	scanf("%d", &n);
	char s[n+1];
	scanf("%s", s);

	std::vector<char> st;
	REP(i, 0, n){
		st.push_back(s[i]);
		int l = st.size();
		if(st[l-3]=='f' && st[l-2]=='o' && st[l-1]=='x'){
			st.pop_back();
			st.pop_back();
			st.pop_back();
		}
	}
	printf("%ld\n", st.size());
	return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <deque>
using namespace std;

int main() {
    int n; cin >> n;
    map<int, int> mp;
    for(int i = 1;i < n ; i++){
        mp[i] = i - 1;
    }

    string s; cin >> s;
    reverse(s.begin(), s.end());
    long num = 0;
    if(n == 1 || n == 2) {
        cout << n << endl;
        return 0;
    }
    if(n == 3) {
        if(s == "xof"){
            cout << 0 << endl;
            return 0;
        }else{
            cout << 3 << endl;
            return 0;
        }
    }

      for(int i = 2 ;i < n; i++) {
          if(s.at(i) == 'f'){
              if(mp[mp[i]] < 0) break;
              if(s.at(mp[i]) == 'o' && s.at(mp[mp[i]]) == 'x'){
                  mp[i + 1] = mp[mp[mp[mp[i + 1]]]];
                  num++;
              }
          }
      }

    cout << n - 3*num << endl;

}