#include <bits/stdc++.h>
using namespace std;
const int64_t mod = 1e9 + 7;
const int N = 2e6 + 1;
int n, k, ar[N];
string s;
int main() {
  cin >> k >> s;
  n = s.size();
  for (int i = 0; i < n; i++) ar[i + 1] = ar[i] + (s[i] == '1');
  int64_t x = 0;
  for (int i = 1; i <= n; i++)
    if (s[i - 1] == '0')
      x += upper_bound(ar + i, ar + n + 1, ar[i] + k) -
           lower_bound(ar + i, ar + n + 1, ar[i] + k);
    else
      x += upper_bound(ar + i, ar + n + 1, ar[i] + k - 1) -
           lower_bound(ar + i, ar + n + 1, ar[i] + k - 1);
  cout << x;
  return 0;
}
