#include <bits/stdc++.h>
using namespace std;
int main() {
  int n1;
  cin >> n1;
  string s1;
  cin >> s1;
  int ans = 0;
  for (int i = 0; i < s1.size();) {
    if (i >= 4) {
      if (s1[i - 1] == s1[i - 2] && s1[i - 2] == s1[i - 3]) {
        ans++;
      }
    }
    i += n1;
  }
  cout << ans << endl;
}
