#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string ss;
  cin >> ss;
  int cnt = 0;
  int ans = 0;
  for (int i = 0; i < ss.length(); i++) {
    if (i >= 3 && cnt == 0 && ss[i - 1] == ss[i - 2] &&
        ss[i - 2] == ss[i - 3]) {
      ans++;
    }
    cnt++;
    cnt %= n;
  }
  cout << ans << "\n";
  return 0;
}
