s=input()
n=len(s)
for i in range(10,-1,-1):
    t='1'*2**i+'0'*2**i
    while t in s:
        s=s.replace(t,'')
for i in range(10,-1,-1):
    t='0'*2**i+'1'*2**i
    while t in s:
        s=s.replace(t,'')
print(n-len(s))
