#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, len;
  string str;
  while (cin >> n >> str) {
    len = str.length();
    long long cnt = 0;
    for (int i = 3; i < len; i++) {
      if (i % n == 0 && str[i - 1] == str[i - 2] && str[i - 2] == str[i - 3])
        cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}
