#include <bits/stdc++.h>
using namespace std;
int k;
string s;
int a[1000005];
int main() {
  cin >> k >> s;
  int cont = 0;
  int len = s.length();
  long long ans = 0;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '1') a[cont++] = i;
  if (k == 0) {
    for (int i = 0; i < s.length(); i++) {
      long long temp = 0;
      while (s[i] == '0' && i < s.length()) {
        temp++;
        i++;
      }
      ans += (temp + 1) * temp / 2;
    }
    cout << ans << endl;
    return 0;
  }
  if (cont < k) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < cont; i++) {
    long long temp1 = a[i] - 1, temp2 = a[i + k - 1] + 1;
    long long l = 1, r = 1;
    if (i + k - 1 >= cont) break;
    while (s[temp1] == '0' && temp1 >= 0) {
      l++;
      temp1--;
    }
    while (s[temp2] == '0' && temp2 < s.length()) {
      r++;
      temp2++;
    }
    ans += r * l;
  }
  cout << ans << endl;
}
