S=input() connect=0 ans=0 for i in S: if i=="0": if connect&1 : connect-=1 ans+=connect//2 else: connect+=1 print(ans)