#include<bits/stdc++.h>
using namespace std;
const int P = 8521,mod = 1000000007;
unsigned long t[444444],f[444444];
void build(string s,int v,int tl,int tr){
if(tl==tr)t[v]=(t[v]*P)+(s[tl]-48);
else {
int tm=(tl+tr)>>1;
build(s,v*2,tl,tm);
build(s,v*2+1,tm+1,tr);
t[v]=(t[v*2]+t[v*2+1])*P;
t[v]%=mod;
}
}
void build2(string s,int v,int tl,int tr){
if(tl==tr)f[v]=(f[v]*P)+(s[tl]-48);
else {
int tm=(tl+tr)>>1;
build2(s,v*2,tl,tm);
build2(s,v*2+1,tm+1,tr);
f[v]=(f[v*2]+f[v*2+1])*P;
f[v]%=mod;
}
}
unsigned long geth(int v,int tl,int tr,int l,int r){
if(l>r)return 0;
if(tl==l && tr==r)return t[v]%mod;
else {
int tm=(tl+tr)>>1;
return (geth(v*2,tl,tm,l,min(r,tm))+geth(v*2+1,tm+1,tr,max(l,tm+1),r))*P;
}
}
unsigned long getf(int v,int tl,int tr,int l,int r){
if(l>r)return 0;
if(tl==l && tr==r)return f[v]%mod;
else {
int tm=(tl+tr)>>1;
return (geth(v*2,tl,tm,l,min(r,tm))+geth(v*2+1,tm+1,tr,max(l,tm+1),r))*P;
}
}
int n;
int solve(int l,int r){
if(l==r)return 1;
unsigned a1,a2;
a1=geth(1,0,n-1,l,r);
a2=getf(1,0,n-1,l,r);
a1%=mod;
a2%=mod;
return (a1==a2);
}
int main(){
cin.tie(NULL);
ios_base::sync_with_stdio(0);
int k;
long long ans=0;
string r;
cin>>k;
cin>>r;
n=(int)r.size();
build(r,1,0,n-1);
string s=r;
reverse(r.begin(),r.end());
build2(r,1,0,n-1);
bool g=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(j-i==k-1 && i<=j){
g=solve(i,j);
ans+=g;
}
}
}
cout<<ans<<"\n";
return 0;}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgaW50IFAgPSA4NTIxLG1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