#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long k = 0, ans = 0;
  string s;
  cin >> k >> s;
  vector<long long> pref(s.size() + 1);
  for (long long i = 0; i < s.size(); i++)
    pref[i + 1] = pref[i] + (s[i] == '1');
  for (long long i = 1; i <= s.size(); i++) {
    if (pref[i] >= k) {
      ans += (upper_bound(pref.begin(), pref.begin() + i, pref[i] - k) -
              pref.begin()) -
             (lower_bound(pref.begin(), pref.begin() + i, pref[i] - k) -
              pref.begin());
    }
  }
  cout << ans;
  return 0;
}
