#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxN = 1+1000*100;
#define int long long
const int mod = 1e9+7;

signed main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	vector<char> v;
	for(int i = 0 ;i<n;i++)
	{
		v.push_back(s[i]);
		if(v.size()>=3)
		{
			int sz = v.size();
			if(v[sz-1]=='x' && v[sz-2]=='o' && v[sz-3]=='f')
			{
				v.pop_back();
				v.pop_back();
				v.pop_back();
			}
		}
	}
	cout<<v.size();
}

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

int main() {

  int N, K;
  cin >> N >> K;
  
  vector<int> count(N+10);
  int a;
  for (int i = 0; i < N; i++) {
    cin >> a;
    count[a]++;
  }
  
  count[0] = min(count[0],K);
    
  int sum = 0;
  for (int i = 1; i < N+10; i++) {
    if (count[i-1] <= count[i]) {
      count[i] = count[i-1];
    }
    else {
      sum += (count[i-1]-count[i])*i;
    }
    
    if (count[i] == 0) {
      break;
    }
  }
  
  cout << sum << endl;
  
return 0;
}