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