#include <bits/stdc++.h>
using namespace std;
inline void boost() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
}
const long long maxn = 2e5 + 123;
const long long inf = 1e9 + 123;
const long long linf = 1e18 + 123;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double pi = acos(-1);
int dx[4] = {0, 1, -1, 0};
int dy[4] = {1, 0, 0, -1};
int main() {
  boost();
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cntr = 0;
  for (int i = 4; i < s.size(); i++) {
    if (i % n == 0 && s[i - 1] == s[i - 2] && s[i - 3] == s[i - 1]) {
      cntr++;
    }
  }
  cout << cntr;
  return 0;
}
