#include <bits/stdc++.h>
using namespace std;
int n, k, p, i;
struct reg {
  int x, y, z;
} v[100100];
inline bool cmp1(reg a, reg b) {
  if (a.x != b.x) return a.x > b.x;
  return a.y > b.y;
}
inline bool cmp2(reg a, reg b) { return a.y < b.y; }
char s[5000];
int main() {
  int n, sol = 0;
  cin >> n;
  cin >> (s + 1);
  for (i = n + 1; s[i]; i += n)
    if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3]) ++sol;
  cout << sol << '\n';
  return 0;
}
