import sys def main(): def input(): return sys.stdin.readline()[:-1] N = input() ans = 0 L = list(N.split("00")) for e in L: for k in range(len(e)): if e[k] == "1": ans += min(e[k:].count("1"),e[k:].count("0")+2) break print(ans) if __name__ == '__main__': main()