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