#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, l, count = 0;
  string str;
  cin >> n;
  cin >> str;
  l = str.size();
  if (n == 1) {
    if (l > 4)
      cout << l - 3;
    else
      cout << 0;
    return 0;
  }
  if (n == 2) {
    for (i = 3; i < l; i++) {
      if (i % 2 != 0) continue;
      if (str[i - 1] == str[i - 3]) count++;
    }
    cout << count;
    return 0;
  }
  if (n == 3) {
    for (i = 3; i < l; i++) {
      if (i % 3 != 0) continue;
      if (str[i - 1] == str[i - 2]) count++;
    }
    cout << count;
    return 0;
  }
  if (n >= 4) {
    for (i = 3; i < l; i++) {
      if (i % n != 0) continue;
      if (str[i - 1] == str[i - 2] && str[i - 2] == str[i - 3]) count++;
    }
    cout << count;
    return 0;
  }
}
