#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=998244353;
constexpr ll INF=1e18;

int main(){
    ll n, m; cin >> n >> m;
    VI a(m); REP(i,m) cin >> a[i];
    sort(ALL(a));
    ll k=n, l=1;
    REP(i,m){
        if(a[i]-l!=0)
            k=min(k,a[i]-l);
        l=a[i]+1;
    }
    if(n+1-l!=0)
        k=min(k,n+1-l);
    ll ans=0;
    l=1;
    REP(i,m){
        if(a[i]-l!=0)
            ans+=(a[i]-l+k-1)/k;
        l=a[i]+1;
    }
    if(n+1-l!=0)
        ans+=(n+1-l+k-1)/k;
    cout << ans << endl;
    return 0;
}
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); ++i)

ll INF = 1ll << 60;

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  stack<int> que;
  int cnt = 0;
  
  rep(i, 0, n){
    if(que.empty()){
      if(s[i] == 'f')
        que.push(0);
      continue;
    }
    
    if(s[i] == 'f'){
      que.push(0);
      continue;
    }
    if(s[i] == 'o'){
      if(que.top() == 0){
        que.pop();
        que.push(1);
      }
      else{
        stack<int> tmp;
        que = tmp;
      }
      continue;
    }
    if(s[i] == 'x'){
      if(que.top() == 1){
        que.pop();
        cnt++;
      }
      else{
        stack<int> tmp;
        que = tmp;
      }
      continue;
    }
    
    else{
      stack<int> tmp;
      que = tmp;
    }
  }
  
  cout << n-cnt*3 << endl;
  
  return 0;
  
}