#include <bits/stdc++.h>
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, t = 0, ans = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < s.size(); ++i) {
    if (t == 0 && i >= 3) {
      if (s[i - 1] == s[i - 2] && s[i - 1] == s[i - 3] && s[i - 2] == s[i - 3])
        ++ans;
    }
    t = (t + 1) % n;
  }
  cout << ans << endl;
  return 0;
}
