#include "bits/stdc++.h"
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main(){
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	int n;
	cin >> n;
	string s;
	cin >> s;

	if(n<3) cout<<n;
	else{
		int temp=n;
		stack<char> st;
		for(int i=0; i<n; i++){
			if(s[i]=='x'){
				char c1='.',c2='.';
				if(!st.empty()){
					c1 = st.top();st.pop();
				}
				if(!st.empty()){
					c2 = st.top();st.pop();
				}
				// debug(i,c1,c2);
				if(c1=='o' && c2=='f'){
					temp-=3;
				}else{
					st.push(c2);
					st.push(c1);
					st.push('x');
				}
			}else{
				st.push(s[i]);
			}
		}
		cout<<temp;
	} 

	return 0;
}
#include<bits/stdc++.h>
#define int long long
using namespace std;
stack<char> st;
string s;
int n;
signed main(){
	cin>>n>>s;
	for(int i=0;i<n;i++){
		st.push(s[i]);
		if(st.size()<3) continue;
		string cur="";
		for(int j=0;j<3;j++) cur+=st.top(),st.pop();
		//cout<<cur<<"\n";
		if(cur!="xof") st.push(cur[2]),st.push(cur[1]),st.push(cur[0]);
	}
	cout<<st.size();
	return 0;
}