#include <bits/stdc++.h>
using namespace std;
int i, n, rs, who;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> s;
  for (i = 0; i < s.size(); ++i, who = (who + 1) % n) {
    if (who) continue;
    if (i > 2 && s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3]) ++rs;
  }
  cout << rs << '\n';
  return 0;
}
