#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 42;
long long int max(long long int a, long long int b) { return a > b ? a : b; }
long long int min(long long int a, long long int b) { return a < b ? a : b; }
long long int gcd(long long int a, long long int b) {
  while (b) {
    long long int t = a;
    a = b;
    b = t % b;
  }
  return a;
}
long long int lcm(long long int a, long long int b) {
  return (max(a, b) / gcd(a, b)) * min(a, b);
}
void pairsort(long long int a[], long long int b[], long long int n) {
  pair<long long int, long long int> pairt[n];
  for (long long int i = 0; i < n; i++) {
    pairt[i].first = a[i];
    pairt[i].second = b[i];
  }
  sort(pairt, pairt + n);
  for (long long int i = 0; i < n; i++) {
    a[i] = pairt[i].first;
    b[i] = pairt[i].second;
  }
}
long long int extendedGcd(long long int a, long long int b, long long int& x,
                          long long int& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long int x1, y1;
  long long int d = extendedGcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long int binaryToDecimal(string n) {
  string num = n;
  long long int dec_value = 0;
  long long int base = 1;
  long long int len = num.length();
  for (long long int i = len - 1; i >= 0; i--) {
    if (num[i] == '1') dec_value += base;
    base = base * 2;
  }
  return dec_value;
}
long long int nCr(long long int n, long long int k) {
  long long int C[n + 1][k + 1];
  long long int i, j;
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= min(i, k); j++) {
      if (j == 0 || j == i)
        C[i][j] = 1;
      else
        C[i][j] = (C[i - 1][j - 1] % 1000000007 + C[i - 1][j] % 1000000007) %
                  1000000007;
    }
  }
  return C[n][k] % 1000000007;
}
long long int countDivisors(long long int n) {
  long long int cnt = 0;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        cnt++;
      else
        cnt = cnt + 2;
    }
  }
  return cnt;
}
long long int highestPowerof2(long long int n) {
  long long int p = (long long int)log2(n);
  return (long long int)pow(2, p);
}
long long int smallestDivisor(long long int n) {
  if (n % 2 == 0) return 2;
  for (long long int i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return i;
  }
  return n;
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
const int maxN = 100001;
int st[4 * maxN];
int arr[maxN];
void build(int si, int ss, int se) {
  if (ss == se) {
    st[si] = arr[ss];
    return;
  }
  int mid = (ss + se) / 2;
  build(2 * si, ss, mid);
  build(2 * si + 1, mid + 1, se);
  st[si] = min(st[2 * si], st[2 * si + 1]);
}
int query(int si, int ss, int se, int qs, int qe) {
  if (qs > se || qe < ss) return maxN;
  if (ss >= qs && se <= qe) return st[si];
  int mid = (ss + se) / 2;
  int leftans = query(2 * si, ss, mid, qs, qe);
  int rightans = query(2 * si + 1, mid + 1, se, qs, qe);
  return min(leftans, rightans);
}
void update(int si, int ss, int se, int qi) {
  if (ss == se) {
    st[si] = arr[ss];
    return;
  }
  int mid = (ss + se) / 2;
  if (qi <= mid)
    update(2 * si, ss, mid, qi);
  else
    update(2 * si + 1, mid + 1, se, qi);
  st[si] = min(st[2 * si], st[2 * si + 1]);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t1 = 1;
  while (t1--) {
    int n, i;
    string s;
    cin >> n >> s;
    int m = s.size(), r = 0;
    for (long long int i = 0; i < m; i++) {
      int j = i % n;
      if (j == 0 && i >= 3) {
        if (s[i - 1] == s[i - 2] && s[i - 1] == s[i - 3]) r++;
      }
    }
    cout << r << "\n";
  }
  return 0;
}
