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