#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int sum[MAXN];
int main() {
  int k;
  string s;
  while (cin >> k >> s) {
    int len = s.length();
    sum[0] = s[0] - '0';
    for (int i = 1; i < len; i++) sum[i] = sum[i - 1] + (s[i] - '0');
    long long ans = 0;
    for (int i = 0; i < len; i++) {
      int pos1 =
          lower_bound(sum + i, sum + len, sum[i] + k - (s[i] - '0')) - sum;
      int pos2 =
          upper_bound(sum + i, sum + len, sum[i] + k - (s[i] - '0')) - sum;
      ans = ans + (pos2 - pos1);
    }
    printf("%lld\n", ans);
  }
  return 0;
}
