#include <bits/stdc++.h>
using namespace std;
long long int uni[2000051];
long long int a[1000001], k, n;
string s;
unsigned long long int kis0() {
  unsigned long long int ans = 1;
  for (int i = 0; i < n; i++) {
    unsigned long long int x = 1;
    while (s[i] == 48 && i < n) {
      x++;
      i++;
    }
    x--;
    ans += (x * (x + 1)) / 2;
  }
  return ans - 1;
}
int main() {
  cin >> k;
  cin >> s;
  n = s.length();
  if (!k) {
    cout << kis0();
    return 0;
  }
  a[0] = s[0] - 48;
  uni[a[0]]++;
  for (int i = 1; i < n; i++) {
    a[i] = a[i - 1] + s[i] - 48;
    uni[a[i]]++;
  }
  unsigned long long int ans = 1;
  for (int i = 0; i < n - k + 1; i++) {
    if (s[i] - 48 && k)
      ans += uni[a[i] + k - 1];
    else
      ans += uni[a[i] + k];
  }
  cout << ans - 1;
  return 0;
}
