#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int sz = s.size();
  int sol = 0;
  for (int j = 0; j < sz; j++) {
    if (j % n == 0 && j >= 3) {
      bool ok = true;
      for (int k = 2; k <= 3; k++) {
        if (s[j - k] != s[j - 1]) {
          ok = false;
          break;
        }
      }
      if (ok) {
        sol++;
      }
    }
  }
  cout << sol << '\n';
}
