#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int k;
  string second;
  cin >> k >> second;
  vector<long long int> v;
  for (long long int i = 0; i < second.size(); i++) {
    if (second[i] == '1') {
      v.push_back(i);
    }
  }
  if (v.size() < k) {
    cout << 0;
    return 0;
  }
  if (k == 0) {
    long long int u = 0;
    vector<long long int> z;
    for (long long int i = 0; i < second.size(); i++) {
      if (second[i] == '0') {
        u++;
      } else {
        z.emplace_back(u);
        u = 0;
      }
    }
    z.emplace_back(u);
    long long int t = 0;
    for (long long int i = 0; i < z.size(); i++) {
      t += (z[i] * (z[i] + 1)) / 2;
    }
    cout << t;
    return 0;
  }
  long long int n = second.size();
  long long int c = 0;
  for (long long int i = 0; i < v.size(); i++) {
    long long int left = v[i];
    long long int ex = i + k - 1;
    if (ex >= v.size()) {
      break;
    }
    long long int right = v[i + k - 1];
    long long int l0, r0;
    if (i == 0) {
      if (v[i] == 0) {
        l0 = 0;
      } else {
        l0 = v[i];
      }
    } else {
      l0 = v[i] - v[i - 1] - 1;
    }
    if (ex == v.size() - 1) {
      r0 = n - 1 - v[ex];
    } else {
      r0 = v[i + k] - v[i + k - 1] - 1;
    }
    c += (l0 + r0 + l0 * r0);
    c++;
  }
  cout << c;
  return 0;
}
