#include <bits/stdc++.h>
using namespace std;
const int N = 2002;
char ch[N];
int main() {
  int n;
  cin >> n;
  cin >> ch;
  int len = strlen(ch), ans = 0;
  for (int i = 0; i < len; i++) {
    char x = ch[i], t;
    if (i % n == 0 && i >= 3) {
      if (ch[i - 1] == ch[i - 2] && ch[i - 2] == ch[i - 3]) ans++;
    }
  }
  cout << ans << endl;
}
