#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int count = 0;
  int pos = 0;
  int ans = 0;
  cin >> n;
  string s;
  cin >> s;
  int l = s.length();
  if (l < 4) {
    cout << ans;
    return 0;
  }
  for (int i = 0; i < l; i += n) count++;
  for (int i = 1; i < count; i++) {
    pos = pos + n;
    if (s[pos - 1] == s[pos - 2] && s[pos - 2] == s[pos - 3]) ans++;
  }
  cout << ans;
}
