#include #include #include using namespace std; int main(){ string s; cin >> s; const int sz = s.length(); string pr(sz,'1'); bitset<40> b1(s); bitset<40> b2(s); bitset<40> pare(pr); if(s[0] == '0'){ cout << -1 << endl; } else{ int res = 0; int l1 = 0,l2 = 0; while(true){ if(b1 == pare){ break; } for(int i=sz-1;i>=0;i++){ if(!b1[i]){ l1 = i; break; } } res++; int l = sz-1-l1; b1 >>= l; b1 |= b2; b2 = b1; } cout << res << endl; } return 0; }