#include <bits/stdc++.h>
using namespace std;
int ar[1000009];
int check(int a) {
  int s, d, f, g, h, j, k;
  if (ar[a] == ar[a - 1] && ar[a] == ar[a - 2] && ar[a] == ar[a - 3]) return 1;
  return 0;
}
int check1(int a) {
  int s, d, f, g, h, j, k;
  s = !ar[a];
  if (s == ar[a - 1] && s == ar[a - 2] && s == ar[a - 3]) return 1;
  return 0;
}
string aa;
int main() {
  int a, s, d, f, g, h, j, k, l;
  char ch;
  cin >> a;
  cin >> aa;
  s = aa.size();
  for (d = 0; d < s; d++) {
    ch = aa[d];
    if (ch == 'b') ar[d] = 1;
  }
  f = 0;
  for (d = a; d < s; d = d + a) {
    g = check(d);
    h = check1(d);
    f = f + max(g, h);
  }
  cout << f << endl;
}
