
// 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 DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

template <typename T>
inline T gi()
{
    T f = 1, x = 0; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return f * x;
}

const int INF = 0x3f3f3f3f, N = 200003, M = N << 1;

int n;
char s[N], stk[N];
int tp;

int main()
{
    //File("");
    n = gi <int> ();
    scanf("%s", s + 1);
    for (int i = 1; i <= n; i+=1)
    {
    	stk[++tp] = s[i];
    	if (tp >= 3 && stk[tp] == 'x' && stk[tp - 1] == 'o' && stk[tp - 2] == 'f')
    		tp -= 3;
    }
    printf("%d\n", tp);
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

using vint = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define x first
#define y second
#define all(v) v.begin(),v.end()

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

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

  vector<char> v;
  for(char c : s) {
    v.push_back(c);
    if(v.size() >= 3 && v[int(v.size()) - 3] == 'f' && v[int(v.size()) - 2] == 'o'
      && v.back() == 'x') {
        v.pop_back(); v.pop_back(); v.pop_back();
      }
  }

  cout << v.size() << '\n';

  return 0;
}