#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  cin >> n;
  cin >> s;
  int i = n;
  int ans = 0;
  char x;
  while (true) {
    if (i >= s.length()) break;
    if (i - 1 >= 0 && i - 2 >= 0 && i - 3 >= 0) {
      x = s[i - 1];
      if (x == s[i - 2] && x == s[i - 3]) ans++;
    }
    i = i + n;
  }
  cout << ans << endl;
  return 0;
}
