#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned short n;
  cin >> n;
  cin.get();
  char* str = (char*)malloc(2001);
  memset(str, 0x00, 2001);
  cin.getline(str, 2001);
  unsigned short turnsCount = (unsigned short)strlen(str);
  unsigned short i;
  unsigned short result = 0;
  unsigned short sum;
  for (i = n; i < turnsCount; i += n) {
    sum = str[i - 1] + str[i - 2] + str[i - 3];
    if ((sum == ('a' + 'a' + 'a')) || (sum == ('b' + 'b' + 'b'))) result++;
  }
  cout << result;
  free(str);
  return 0;
}
