#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long k;
  cin >> k;
  string str;
  cin >> str;
  long long index = -1;
  long long count = 0;
  vector<long long> zero;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '0') {
      count++;
    } else {
      index = i;
      count++;
      zero.push_back(count);
      count = 0;
    }
  }
  zero.push_back(str.size() - index);
  long long sum = 0;
  if (k == 0) {
    for (int i = 0; i < zero.size(); i++) {
      sum += (zero[i] - 1) * (zero[i]) / 2;
    }
    cout << sum << endl;
    return 0;
  }
  long long less = 0;
  long long gre = k;
  while (gre < zero.size()) {
    sum += zero[less] * zero[gre];
    less++;
    gre++;
  }
  cout << sum << endl;
}
