#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
char s[N];
int dp[N];
int main() {
  int k;
  long long sum = 0, res = 0;
  scanf("%d%s", &k, s);
  int len = strlen(s);
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (int i = 0; i < len; i++) {
    if (s[i] == '1') sum++;
    if (sum >= k) res += dp[sum - k];
    dp[sum]++;
  }
  cout << res;
  return 0;
}
