from collections import deque q=list(str(input())) q=deque(list(map(int,q))) ans=0 s=deque() while q: x=q.popleft() s.append(x) if 3<=len(s): if s[-3]==1 and s[-2]==1 and s[-1]==0: s[-3]=0 s[-1]=1 ans+=1 while s: x=s.pop() q.appendleft(x) if 3<=len(q): if q[0]==1 and q[1]==1 and q[2]==0: q[0]=0 q[2]=1 ans+=1 print(ans)