import sequtils,strutils var N = "0" & stdin.readline f : bool cnt = 0 for i in countdown(N.high, 1): if N[i] == '1': if f == true and N[i - 1] == '1': continue elif f == false and N[i - 1] == '1': f = true cnt += 1 elif f == true and N[i - 1] == '0': N[i - 1] = '1' f = false elif f == false and N[i - 1] == '0': cnt += 1 if N[0] == '1': cnt += 1 echo cnt