#include<bits/stdc++.h>
using namespace std::chrono;
using namespace std;
#define int long long
#define loop(i, start, end) for (int i = start; i <= end; i++)
#define rloop(i, start, end) for (int i = start; i >= end; i--)
#define read(a,n) loop(i,0,n-1) cin>>a[i];
#define vi vector<int>
#define vec(x) vector<x>
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define all(v) (v).begin(),(v).end()
#define arl(v) (v).rbegin(),(v).rend()
#define fsp(a) fixed<<setprecision(a)
#define mem(a,with) memset(a, with, sizeof (a))
#define vmn(a) (*min_element(a.begin(),a.end()))   
#define vmx(a) (*max_element(a.begin(),a.end()))
#define bs(a,key) binary_search(all(a),key)    /// return bool.
#define rotl(a,x) rotate(a.begin(),a.begin()+x,a.end());
#define rotr(a,x) rotl(a,a.size()-x);
#define nl cout<<endl
#define dbg(x) cerr << #x << " :: " << x << endl;
#define dbg2(x, y) cerr << #x << " :: " << x << "\t" << #y << " :: " << y << endl;
#define MOD 1000000007
int add(int x, int y) {int res = x + y; return (res >= MOD ? res - MOD : res);}
int mul(int x, int y) {int res = x * y; return (res >= MOD ? res % MOD : res);}
int power(int x, int y) {int res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}

void solve(){
    //code goes here
    int N;
    cin >> N;
    string S;
    cin >> S;
    stack<char> st;
    int res = N;
    for (const auto &s : S) {
        if (s == 'f') {
            st.push(s);
        }
        else if (s == 'o') {
            st.push(s);
        } 
        else if (s == 'x') {
            if (!st.empty() && st.top() == 'o') {
                st.pop();
                if (!st.empty() && st.top() == 'f') {
                    st.pop();
                    res -= 3;
                } 
                else {
                    st.push('a');
                }
            }
            else {
                st.push('a');
            }
        }   
        else {
            st.push('a');
        }
    }
  cout<<res;
}

int32_t main()
{
auto start = chrono::high_resolution_clock::now();
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
    int t=1;
    // cin>>t;
    while (t--)
    {
        solve();
    }
#ifndef ONLINE_JUDGE
     auto stop = chrono::high_resolution_clock::now();
    auto duration = chrono::duration_cast<microseconds>(stop - start);
    cout<<"\n\nExecuted In: "<<duration.count()<<" ms";
#endif
    return 0;
}
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int N;
string s;

void input(void){
    cin >> N >> s;
}

int solve(void){
    static char buf[200005];
    int ptr = 0;
    for (int i = 0; i < N; ++i){
        if (
            ptr >= 2 &&
            buf[ptr - 2] == 'f' &&
            buf[ptr - 1] == 'o' &&
            s[i] == 'x'
        ){
            ptr -= 2;
        }
        else buf[ptr++] = s[i];
    }
    return ptr;
}

int main(void){
    input();
    cout << solve() << endl;
    return 0;
}