#include #include #include #include #include #include using namespace std; #define REP(A,B) for(int (A)=0;(A)<(B);(A)++) char str[44]; string S; int best = 5; string S2; int n; void dfs(long long val, int dist) { //printf("%lld %d\n", val, dist); if(val == (1LL<>i); dfs(nval, dist+1); } } int main() { scanf("%s", str); S = string(str); n = strlen(str); if(str[0] == '0') { printf("-1\n"); return 0; } if(n >= 33) { bool allzero = true; for(int i = 1; i <= 32; i++) if(str[i] != '0') allzero = false; if(allzero) { printf("6\n"); return 0; } } long long val = 0; REP(i, n) val = 2*val + (S[i] == '1'); dfs(val, 0); printf("%d\n", best); return 0; }