#include <bits/stdc++.h>
long long unsigned gcd(long long unsigned a, long long unsigned b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
using namespace std;
char s[5000];
int len, n, res = 0, yer = 0;
int main() {
  scanf("%d %s", &n, s + 1);
  len = strlen(s + 1);
  for (int i = 1; i <= len; i++) {
    if (i >= 4 and !yer and s[i - 3] == s[i - 2] and s[i - 2] == s[i - 1])
      res++;
    yer = (yer + 1) % n;
  }
  cout << res << endl;
}
