#include <bits/stdc++.h>
char s[4000000 + 5];
int main() {
  int i, j, len, ans, n;
  while (~scanf("%d", &n)) {
    scanf("%s", s);
    len = strlen(s);
    ans = 0;
    for (i = 0; i < len; i++)
      if (i != 0 && i % n == 0) {
        if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3] &&
            s[i - 3] == s[i - 1])
          ans++;
      }
    printf("%d\n", ans);
  }
}
