#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vint;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1
#define PI 3.14159265359
#define EPS 1e-9
int main() {
int k,nsum[1000005],sum[1000005];
ll ret=0;
string str;
cin>>k>>str;
sum[0]=str[0]==1?1:0;
rep(i,str.sz)
nsum[i]=0;
nsum[0]=1;
REP(i,1,str.sz) {
sum[i]=sum[i-1]+str[i]==1;
nsum[sum[i]]++;
}
rep(i,str.sz)
ret+=(sum[i]>=k?nsum[sum[i]-k]:0);
cout<<ret<<"\n";
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGZzdHJlYW0+CiNpbmNsdWRlPHNzdHJlYW0+CiNpbmNsdWRlPGNzdGRpbz4KI2luY2x1ZGU8c3RkbGliLmg+CiNpbmNsdWRlPHN0cmluZz4KI2luY2x1ZGU8Y3N0cmluZz4KI2luY2x1ZGU8Y21hdGg+CiNpbmNsdWRlPGFsZ29yaXRobT4KI2luY2x1ZGU8c3RhY2s+CiNpbmNsdWRlPHF1ZXVlPgojaW5jbHVkZTx2ZWN0b3I+CiNpbmNsdWRlPHV0aWxpdHk+CiNpbmNsdWRlPHNldD4KI2luY2x1ZGU8bWFwPgojaW5jbHVkZTxpb21hbmlwPgoKdXNpbmc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