#include <bits/stdc++.h>
using namespace std;
inline long long getint() {
  long long ret = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') ret = ret * 10 + c - '0', c = getchar();
  return ret * f;
}
const int maxn = 100000;
int n, ans;
char s[maxn];
int main() {
  n = getint();
  scanf("%s", s);
  int len = strlen(s + 1);
  for (int i = n; i <= len; i += n)
    if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3]) ans++;
  printf("%d\n", ans);
  return 0;
}
