#include <bits/stdc++.h>
using namespace std;
void data() {}
const int N = 1e6 + 100;
const long long mod = 998244353;
const long long mod2 = 1e9 + 7;
int main() {
  data();
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long k;
  cin >> k;
  string second;
  cin >> second;
  vector<long long> pos;
  long long ans = 0;
  if (k == 0) {
    long long ans = 0;
    long long cur = 0;
    for (long long i = 0; i < second.size(); i++) {
      if (second[i] == '0') {
        cur++;
      } else {
        ans += cur * (cur + 1) / 2;
        cur = 0;
      }
    }
    ans += cur * (cur + 1) / 2;
    cout << ans << '\n';
    return 0;
  }
  pos.push_back(0);
  for (long long i = 0; i < second.size(); i++) {
    if (second[i] == '0') {
      continue;
    }
    pos.push_back(i + 1);
  }
  pos.push_back(second.size() + 1);
  long long cur = 0;
  for (long long i = 0; i < second.size(); i++) {
    if (second[i] == '0') {
      continue;
    }
    cur++;
    if (cur >= k) {
      ans += (pos[cur - k + 1] - pos[cur - k]) * (pos[cur + 1] - pos[cur]);
    }
  }
  cout << ans;
}
