#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int res = 0;
  for (int i = 0; i < s.length(); i++) {
    if (i >= 4 && s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3] && i % n == 0)
      s[i] == s[i - 1], res++;
  }
  cout << res << endl;
}
