#include <bits/stdc++.h>
using namespace std;
char s[1000005];
int a[1000005];
int main() {
  int k, n, i, l, r;
  long long ans;
  scanf("%d", &k);
  scanf("%s", s);
  n = strlen(s);
  for (i = 1; i <= n; i++) a[i] = a[i - 1] + s[i - 1] - '0';
  ans = 0;
  for (i = 1; i <= n; i++) {
    l = lower_bound(a + i, a + n + 1, a[i - 1] + k) - a;
    r = lower_bound(a + i, a + n + 1, a[i - 1] + k + 1) - a;
    if (l > n) break;
    ans += r - l;
  }
  printf("%I64d\n", ans);
  return 0;
}
