#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, counts = 0;
  cin >> n;
  string a;
  cin >> a;
  for (i = 1; i < a.length(); i++) {
    if (i % n == 0) {
      if (a[i - 1] == 'b' && a[i - 2] == 'b' && a[i - 3] == 'b') counts++;
      if (a[i - 1] == 'a' && a[i - 2] == 'a' && a[i - 3] == 'a') counts++;
    }
  }
  cout << counts;
  return 0;
}
