#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-6;
const int INF = 0x3fffffff;
const long long LINF = INF * 1ll * INF;
const double PI = acos(-1.0);
using namespace std;
int main(void) {
  int n, ans = 0;
  string s;
  cin >> n >> s;
  for (int i = n; i < (int)s.size(); i += n) {
    if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3]) ans++;
  }
  cout << ans << endl;
}
