n = int(input(), 2) r = 0 while n != 0: if n&1: if n&2: n += 1 r += 1 n >>= 1 print(r)