#include<stdio.h>
int n;
char a[1000009];
int main(){
int i,j,k;
scanf("%d",&n);
scanf("%s",a);
int res=0;
int ll=0;
for(i=0;i<n;){
if(a[i]=='1'){
i++;
continue;
}
for(j=i;j<n;j++){
if(a[j]=='1')break;
}
int l,r,d;
d=(j-i)<<1;
l=((j+1)&(-2))-d;
r=i&(-2);
int tl=ll;
if(tl<l){
res+=(l-tl);
tl=l;
}
if(tl>r){
tl=r;
}
tl+=d;
printf("%d %d %d %d %d\n",l,r,d,tl,ll);
if(ll<tl){
ll=tl;
}
i=j;
}
if(ll<n){
res+=(n-ll);
}
printf("%d\n",res>>1);
}
I2luY2x1ZGU8c3RkaW8uaD4KaW50IG47CmNoYXIgYVsxMDAwMDA5XTsKaW50IG1haW4oKXsKICAgIGludCBpLGosazsKICAgIHNjYW5mKCIlZCIsJm4pOwogICAgc2NhbmYoIiVzIixhKTsKICAgIGludCByZXM9MDsKICAgIGludCBsbD0wOwogICAgZm9yKGk9MDtpPG47KXsKICAgICAgICBpZihhW2ldPT0nMScpewogICAgICAgICAgICBpKys7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KICAgICAgICBmb3Ioaj1pO2o8bjtqKyspewogICAgICAgICAgICBpZihhW2pdPT0nMScpYnJlYWs7CiAgICAgICAgfQogICAgICAgIGludCBsLHIsZDsKICAgICAgICBkPShqLWkpPDwxOwogICAgICAgIGw9KChqKzEpJigtMikpLWQ7CiAgICAgICAgcj1pJigtMik7CgogICAgICAgIGludCB0bD1sbDsKICAgICAgICBpZih0bDxsKXsKICAgICAgICAgICAgcmVzKz0obC10bCk7CiAgICAgICAgICAgIHRsPWw7CiAgICAgICAgfQogICAgICAgIGlmKHRsPnIpewogICAgICAgICAgICB0bD1yOwogICAgICAgIH0KICAgICAgICB0bCs9ZDsKcHJpbnRmKCIlZCAlZCAlZCAgJWQgJWRcbiIsbCxyLGQsdGwsbGwpOwogICAgICAgIGlmKGxsPHRsKXsKICAgICAgICAgICAgbGw9dGw7CiAgICAgICAgfQogICAgICAgIGk9ajsKICAgIH0KICAgIGlmKGxsPG4pewogICAgICAgIHJlcys9KG4tbGwpOwogICAgfQogICAgcHJpbnRmKCIlZFxuIixyZXM+PjEpOwp9