#include <bits/stdc++.h>
const int INF = 2000000000;
const double PI = 3.14159265358979323846;
const unsigned long long MOD = 100000000000000000;
using namespace std;
int main() {
  int n, ans(0);
  string s;
  cin >> n;
  cin >> s;
  if (n == 2) {
  }
  int l = s.length();
  for (int i(0); i < l; i += n) {
    if (i - 3 >= 0 && s[i - 3] == s[i - 2] && s[i - 2] == s[i - 1]) ans++;
  }
  cout << ans;
}
