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