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