#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string s;
  cin >> N;
  cin >> s;
  int L = (int)s.length();
  int res = 0;
  for (int i = 1; i * N < L; i++) {
    int a = s[i * N - 1];
    int b = s[i * N - 2];
    int c = s[i * N - 3];
    if (a == b && b == c) res++;
  }
  cout << res << endl;
  return 0;
}
