#include <bits/stdc++.h>
using namespace std;
template <class T>
void miz(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
void maz(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
void clear(T &x) {
  T t;
  x.swap(t);
}
template <class T>
T gcd(T a, T b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sqr(T x) {
  return x * x;
}
unsigned HASH(const char *p) {
  unsigned r = 0;
  while (*p) r = r * 257 + 1 + *p++;
  return r;
}
int ROUND(double x) { return x >= 0 ? x + 0.5 : x - 0.5; }
int cnt[1000005];
int main() {
  int k, c, i, now = 0;
  long long ans = 0;
  scanf("%d ", &k);
  cnt[0] = 1;
  for (i = 1; (c = getchar()) != '\n'; i++) {
    if (c == '1') now++;
    if (now >= k) ans += cnt[now - k];
    cnt[now]++;
  }
  cout << ans << endl;
  return 0;
}
