#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  int count = 0, ind = -1, out = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == ind || i % n == 0)
      count++;
    else
      count = 0;
    ind = s[i];
    if (count >= 3 && i >= 3 && i % n == 0) out++;
  }
  cout << out << "\n";
  return 0;
}
