#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string str;
  int n, t, cnt = 0;
  cin >> n >> str;
  t = str.size();
  int i = n;
  if (t < 4)
    cnt = 0;
  else {
    while (i < t) {
      if (str[i - 1] == 'a' && str[i - 2] == 'a' && str[i - 3] == 'a')
        cnt++;
      else if (str[i - 1] == 'b' && str[i - 2] == 'b' && str[i - 3] == 'b')
        cnt++;
      i += n;
    }
  }
  cout << cnt << endl;
  return 0;
}
