#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll n;
    string s;
    cin >> n >> s;

    string t = "";
    for(auto c : s) {
        t += c;
        if(t.size() >= 3 && t.substr(t.size() - 3, 3) == "fox") {
            rep(i, 3) {
                t.pop_back();
            }
        }
    }
    
    out(t.size());
    re0;
}
#include <bits/stdc++.h>
#define INF 1000000007
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i < b; i++)
 
using namespace std;
 
typedef long long ll;
typedef long long int  lli;
typedef long double ld;
typedef vector<int> vi;
typedef unordered_map<int,int> umi ;
typedef unordered_set<int> usi ;
typedef pair<int,int> pi;
#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


 
 
//declare here -------------------------------------------------------------------------------
const int N =4e5+1;
bool taketest=false ;
vi adj[N] ;
bool visited[N] ;
bool visited2[N] ;
bool cycle(int u ,int p){
	if(visited2[u]) return true ;
	visited2[u] =true ;
	bool ans=false ;
	for(auto v:adj[u]){
		if(v==p) continue ;
		ans|= cycle(v,u) ;
	}
	return ans ;
}

int sze(int u ,int p){
	if(visited[u]) return 0 ;
	visited[u] =true ;
	int res=0 ;
	res++ ;
	for(auto v:adj[u]){
		if(v==p) continue ;
		res+= sze(v,u) ;
	}
	return res ;
}

// solve here ---------------------------------------------------------------------------------
 
void solve(){
	int n ;
	cin>>n ;
	int u,v ;
	REP(i,0,n){
		cin>>u>>v ;
		adj[u].PB(v) ;
		adj[v].PB(u) ;
	}
	int ans=0 ;
	REP(i,0,N){
		if(visited[i]) continue ;
		ans+=sze(i,-1) ;
		if(!cycle(i,-1)) ans-- ;
	}
	cout<<ans ;


}



















 
 
 
//--------------------------------------------------------------------------------------------
 


















int main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long test =1 ;
    if(taketest) cin>>test ;
    while(test--){
        solve() ;
        cout<<"\n" ;
    }
    return 0 ;
}