#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG //checks for container overflows
#pragma GCC optimize "trapv" //to chcek for int overflow
#pragma -Wduplicated-cond //dupilcate conditions
#endif
#include "bits/stdc++.h"
using namespace std;
using namespace chrono;
typedef unsigned long long int ull;
typedef long long ll;
#define F first
// #define S second
#define nl '\n'
#define de1(x) cerr << #x << ":" << x <<nl;
#define de2(x,y) cerr << #x << ":" << x << " " << #y << ":" << y << nl
#define de3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define de4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define all(x) x.begin(), x.end()
#define rt return 0;
#define vvi vector<vector<int>>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define um unordered_map<int,int>
const float pi = 3.14;
const ull mod = 1ll << 32;

void solve()
{
  stack<char> s;

  int n;
  string str;
  cin >> n >> str;
  if (n <= 3 && str != "fox")
  {
    cout << n;
    return;
  }

  register int cnt = 0, i;

  for (i = 0; i < n; i++)
  {
    if (str[i] == 'x' && s.size() && s.top() == 'o')
    {
      s.pop();
      if (s.size() && s.top() == 'f')
      {
        cnt += 3;
        s.pop();
        continue;
      }
      s.push('o');
      s.push('x');
    }

    else
      s.push(str[i]);
  }

  cout << n - cnt;

}

int main() {

#ifndef ONLINE_JUDGE
  auto start = high_resolution_clock::now();
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  fast

  solve();

#ifndef ONLINE_JUDGE
  auto end = high_resolution_clock::now();
  double time_taken = duration_cast<nanoseconds>(end - start).count();
  time_taken *= 1e-9;
  cerr << "Time : " << fixed << time_taken << setprecision(9) << nl;
#endif
  return 0;
}

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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = (x << 3) + (x << 1) + (c ^ 48), c = nc;
  return x;
  #undef nc
}

const int maxn = 1e6 + 10;
char A[maxn], B[maxn];
int n, m, nxt[maxn], st[maxn], pos[maxn];

int main() {
  scanf("%d%s",&n, A + 1);
  B[1]='f',B[2]='o',B[m=3]='x';
  for (int i = 2, j = 0; i <= m; i++) {
    while (j && B[i] != B[j + 1]) j = nxt[j];
    nxt[i] = B[i] == B[j + 1] ? ++j : j;
  }
  int top = 0;
  for (int i = 1, j = 0; i <= n; i++) {
    while (j && A[i] != B[j + 1]) j = nxt[j];
    j += A[i] == B[j + 1];
    pos[i] = j, st[++top] = i;
    if (j == m) {
      top -= m, j = pos[st[top]];
    }
  }
  printf("%d\n",top);
//  rep(i, 1, top) {
//    putchar(A[st[i]]);
//  }
  return 0;
}