import sys from collections import deque # sys.setrecursionlimit(10**6) def debug(*args): print(*args, file=sys.stderr) s = deque(list(map(int, list(input())))) # stack = [] stack_count = 0 ans = 0 while s: si = s.popleft() if si == 0: p = stack_count // 2 ans += p stack_count = 2*p # next_stack = [] # while len(stack) >= 2 and stack[-2] == stack[-1] == 1: # ans += 1 # next_stack.append(stack.pop()) # next_stack.append(stack.pop()) # stack, next_stack = next_stack, stack else: # stack.append(1) stack_count += 1 print(ans)