#include <bits/stdc++.h>
using namespace std;
int AR[1000000 + 7];
int main() {
  int cnt = 0, k;
  string s;
  cin >> k >> s;
  AR[0] = 1;
  int64_t r = 0;
  for (int i = 0; s[i] != '\0'; i++) {
    if (s[i] == '1') cnt++;
    if (cnt >= k) r += AR[cnt - k];
    AR[cnt]++;
  }
  printf("%I64d\n", r);
  return 0;
}
