#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  scanf("%d", &n);
  cin >> s;
  int len = s.size();
  int cnt = 0;
  for (int i = 0; i < len; i++) {
    if (i != 0 && i % n == 0) {
      if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3]) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
