#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long query = 1;
  while (query--) {
    long long k, n, count = 0, i;
    string s;
    cin >> k >> s;
    n = s.length();
    vector<long long> v;
    v.push_back(0);
    for (long long i = 0; i < n; i++) {
      if (s[i] == '1') v.push_back(i + 1);
    }
    v.push_back(n + 1);
    for (i = 0; i < v.size() - k - 1; i++) {
      long long a = v[i + 1] - v[i];
      long long b = v[i + k + 1] - v[i + k];
      k == 0 ? count += a * (a - 1) / 2 : count += a * b;
    }
    cout << count;
  }
}
