#include <bits/stdc++.h>
using namespace std;
long long int fast_exp(long long int a, long long int b) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 0) {
    return fast_exp(((a % 1000000007) * (a % 1000000007)) % 1000000007, b / 2) %
           1000000007;
  }
  return ((a % 1000000007) *
          fast_exp(((a % 1000000007) * (a % 1000000007)) % 1000000007,
                   (b - 1) / 2)) %
         1000000007;
}
long long int comb(long long int n, long long int k) {
  long long int ans = 1, j = 1;
  k = max(k, n - k);
  for (long long int i = n; i > k; --i) {
    ans *= i;
    if (j <= (n - k)) {
      ans = ans / j;
      j++;
    }
  }
  if (j <= (n - k)) {
    ans = ans / j;
    j++;
  }
  return ans;
}
int main() {
  int n, ans = 0;
  cin >> n;
  string s;
  cin >> s;
  int l = s.length();
  int i = n;
  while (i < l) {
    if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3]) {
      ans++;
    }
    i += n;
  }
  cout << ans;
  return 0;
}
