#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; } bool look = true; for(int i=l1;i>= l; b1 |= b2; b2 = b1; } cout << res << endl; } return 0; }