if __name__ == "__main__": apples = int(input(), 2) score = 0 while apples != 0: t = apples & 3 if t == 1: score += 1 apples >>= 2 elif t == 3: score += 1 apples += 1 elif t == 0: apples >>= 2 else: apples >>= 1 print(score)