ans = now = 0 for c in input(): if c == '0': ans += now // 2 now -= now & 1 else: now += 1 print(ans)