
// Problem: B - Abbreviate Fox
// Contest: AtCoder - AtCoder Regular Contest 108
// URL: https://atcoder.jp/contests/arc108/tasks/arc108_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pb push_back
#define dlt decltype
#define vi vector<int>
#define vii vector<vector<int>>
#define INF 0x3f3f3f3f
using namespace std;
#ifdef LOCAL
namespace DEBUG {
	template <typename T>
	inline void _debug(const char* format, T t) {
	  cerr << format << '=' << t << endl;
	}
	
	template <class First, class... Rest>
	inline void _debug(const char* format, First first, Rest... rest) {
	  while (*format != ',') cerr << *format++;
	  cerr << '=' << first << ",";
	  _debug(format + 1, rest...);
	}

	template <typename T>
	ostream& operator<<(ostream& os, const vector<T>& V) {
	  os << "[ ";
	  for (const auto& vv : V) os << vv << ", ";
	  os << "]";
	  return os;
	}
#define debug(...) _debug(#__VA_ARGS__, __VA_ARGS__)
}
using namespace DEBUG;
#endif
template<class T1,class T2>
inline bool cmin(T1 &a,T2 b){return a>b?a=b,1:0;}
template<class T1,class T2>
inline bool cmax(T1 &a,T2 b){return a<b?a=b,1:0;}
template<class T1,class T2,class ...T3>
inline bool cmin(T1 &a,T2 b,T3 ...rest){return cmin(a,b)||cmin(a,rest...);}
template<class T1,class T2,class ...T3>
inline bool cmax(T1 &a,T2 b,T3 ...rest){return cmin(a,b)||cmax(a,rest...);}

ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll gi(){
    ll i=0;bool f=false;char c;
    while (!isdigit(c=getchar())) f=c=='-';
    do i=(i<<3)+(i<<1)+c-'0'; while (isdigit(c=getchar()));
    return f?-i:i;
}
int main(){ 
	int n=gi();
	string a;
	for (int i=1;i<=n;i++) a+=getchar();
	char b[200010];int ni=0;
	for (auto &i:a){
		b[ni++]=i;
		while (ni>=3&&
		b[ni-1]=='x'&&
		b[ni-2]=='o'&&
		b[ni-3]=='f'
		) ni-=3,n-=3;
	}
	cout << n;
}















#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937/*_64*/ rng(chrono::steady_clock::now().time_since_epoch().count());
#define printArr(arr, n) cerr << #arr << " = ["; for(int i=0; i<(n); i++){if (i) cerr << ", "; cerr << arr[i];} cerr << "]\n"
template<class A> ostream& operator<<(ostream &cout, vector<A> const &v) {cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";};
template<class A, class B> ostream& operator<<(ostream &cout, const pair<A,B> &x) {return cout << "(" <<x.first << ", " << x.second << ")";};
void _print() {cerr << "]\n";}
template <class T, class... V> void _print(T t, V... v) {cerr << t; if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#define fi first
#define se second
#define SZ(x) (int)((x).size())
#define pii pair<int,int>
struct dsu{
	vector<int> v, sz, edge;
	dsu(int n) : v(n), sz(n,1), edge(n)
	{
		iota(v.begin(), v.end(), 0);
	}
	int root(int a)
	{
		return (v[a] == a ? a : v[a] = root(v[a]));
	}
	bool unite(int a, int b)
	{
		int a1 = root(a), b1 = root(b);
		if (a1 == b1) {
			edge[a1]++;
			return false;
		}
		if (sz[a1] < sz[b1]) swap(a1,b1);
		sz[a1]+=sz[b1];
		v[b1] = a1;
		edge[a1] += edge[b1]+1;
		return true;
	}
};
const int mx = 400005;
dsu d(mx);
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int q = 0; q < n; q++) {
		int a,b;
		cin >> a >> b;
		d.unite(a,b);
	}
	int ans = 0;
	for (int q = 1; q < mx; q++) {
		if (d.root(q) != q) continue;
		ans += min(d.edge[q], d.sz[q]);
	}
	cout << ans << "\n";
	return 0;
}

