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