S = input() ans = 0 one = 0 for s in S: if s == '1': one += 1 else: one = one // 2 * 2 ans += one // 2 print(ans)