#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, x, y, z, l, now, sum;
char ch[3000], c;
int main() {
  scanf("%d", &n);
  scanf("%s", &ch);
  l = strlen(ch);
  now = 0;
  sum = 0;
  for (i = 0; i < l; i++) {
    if (now == 0) {
      if (i >= 3) {
        c = ch[i - 1];
        if ((ch[i - 2] == c) && (ch[i - 3] == c)) sum++;
        ch[i] = c;
      }
    }
    now++;
    now = now % n;
  }
  printf("%d", sum);
  return 0;
}
