#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int MAXN = 1e6 + 1;
const long double PI = acos(-1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int k;
  cin >> k;
  ;
  vector<int> index;
  long long int ans = 0;
  index.push_back(-1);
  string s;
  cin >> s;
  for (int i = 0; i < (s.size()); ++i) {
    if (s[i] == '1') {
      index.push_back(i);
    }
  }
  index.push_back((int)s.size());
  for (long long int i = 1; i < ((int)index.size() - k); ++i) {
    if (k)
      ans +=
          1ll * (index[i] - index[i - 1]) * (index[i + k] - index[i + k - 1]);
    else
      ans += 1ll * (index[i] - index[i - 1] - 1) *
                 (index[i] - index[i - 1] - 2) / 2 +
             1ll * (index[i] - index[i - 1] - 1);
  }
  cout << ans;
  return 0;
}
