#include <bits/stdc++.h>
using namespace std;
int n;
bool turn[2005];
char act[2005];
int len;
int main() {
  cin >> n;
  cin >> act;
  len = strlen(act);
  len--;
  memset(turn, false, sizeof(turn));
  int ans = 0;
  for (int j = 0; j <= len; j++) {
    if (j % n == 0 && j >= 3) {
      if (act[j - 1] == act[j - 2] && act[j - 1] == act[j - 3]) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
