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