#include<iostream>
using namespace std;
string fz(string s){
int i = s.length();
if(s[0] != '0'){
return "0";
}
while(true){
if(i == 0){
return "0";
}
if(s[i - 1] == '0'){
break;
}
i--;
}
for(int j = 0; j < i; j++){
if(s[j] == '0'){
s[j] = '1';
}else{
s[j] = '0';
}
}
return s;
}
int main(){
int i = 0;
string s;
cin>>s;
int len = s.length();
. while(true){
if(fz(s) == "0"){
cout<<i;
return 0;
}
s = fz(s);
i++;
}
return 0;
}