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