#include <bits/stdc++.h>
using namespace std;
int n, k, last, c, arr[1000002];
long long cnt;
string s;
map<int, int> m;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> k >> s;
  n = s.size();
  arr[0]++;
  for (int i = 0; i < n; i++) {
    c += (s[i] == '1');
    (c >= k) ? cnt += arr[c - k] : cnt += 0;
    arr[c]++;
  }
  cout << cnt << "\n";
  return 0;
}
