#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int current = N;
  int count = 0;
  while (true) {
    if (current >= s.size()) break;
    set<char> vs;
    vs.insert(s[current - 1]);
    vs.insert(s[current - 2]);
    vs.insert(s[current - 3]);
    if (vs.size() == 1) count++;
    current += N;
  }
  cout << count;
}
