#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  int n = s.size();
  int ps[n + 5];
  ps[0] = s[0] - '0';
  for (int i = 1; i < n; i++) ps[i] = ps[i - 1] + s[i] - '0';
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int it1 = lower_bound(ps + i, ps + n, (i ? ps[i - 1] : 0) + k) - ps;
    if (it1 == n) continue;
    int it2 = lower_bound(ps + i, ps + n, (i ? ps[i - 1] : 0) + k + 1) - 1 - ps;
    ans += it2 - it1 + 1;
  }
  cout << ans << '\n';
}
