{"raw_statement":[{"iden":"statement","content":"Little walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations.\n\nFangy takes some positive integer _x_ and wants to get a number one from it. While _x_ is not equal to 1, Fangy repeats the following action: if _x_ is odd, then he adds 1 to it, otherwise he divides _x_ by 2. Fangy knows that for any positive integer number the process ends in finite time.\n\nHow many actions should Fangy perform to get a number one from number _x_?"},{"iden":"input","content":"The first line contains a positive integer _x_ in a **binary system**. It is guaranteed that the first digit of _x_ is different from a zero and the number of its digits does not exceed 106."},{"iden":"output","content":"Print the required number of actions."},{"iden":"examples","content":"Input\n\n1\n\nOutput\n\n0\n\nInput\n\n1001001\n\nOutput\n\n12\n\nInput\n\n101110\n\nOutput\n\n8"},{"iden":"note","content":"Let's consider the third sample. Number 101110 is even, which means that we should divide it by 2. After the dividing Fangy gets an odd number 10111 and adds one to it. Number 11000 can be divided by 2 three times in a row and get number 11. All that's left is to increase the number by one (we get 100), and then divide it by 2 two times in a row. As a result, we get 1."}],"translated_statement":[{"iden":"statement","content":"小海象 Fangy 非常热爱数学。因此，当他无聊时，他会通过一些运算来玩数字。\n\nFangy 取一个正整数 #cf_span[x]，并希望将其变为数字 1。当 #cf_span[x] 不等于 #cf_span[1] 时，Fangy 重复以下操作：如果 #cf_span[x] 是奇数，则将其加 #cf_span[1]；否则，将 #cf_span[x] 除以 #cf_span[2]。Fangy 知道，对于任意正整数，该过程都会在有限步内结束。\n\nFangy 需要执行多少次操作才能从数字 #cf_span[x] 得到数字 1？\n\n第一行包含一个以 *二进制系统* 表示的正整数 #cf_span[x]。保证 #cf_span[x] 的首位数字不为零，且其位数不超过 #cf_span[106]。\n\n请输出所需的行动次数。\n\n考虑第三个样例。数字 #cf_span[101110] 是偶数，因此应将其除以 #cf_span[2]。除法后，Fangy 得到一个奇数 #cf_span[10111]，并将其加一。数字 #cf_span[11000] 可以连续除以 #cf_span[2] 三次，得到数字 #cf_span[11]。剩下的操作是将数字加一（得到 #cf_span[100]），然后连续除以 #cf_span[2] 两次。最终，我们得到 #cf_span[1]。"},{"iden":"input","content":"第一行包含一个以 *二进制系统* 表示的正整数 #cf_span[x]。保证 #cf_span[x] 的首位数字不为零，且其位数不超过 #cf_span[106]。"},{"iden":"output","content":"请输出所需的行动次数。"},{"iden":"examples","content":"输入1输出0输入1001001输出12输入101110输出8"},{"iden":"note","content":"考虑第三个样例。数字 #cf_span[101110] 是偶数，因此应将其除以 #cf_span[2]。除法后，Fangy 得到一个奇数 #cf_span[10111]，并将其加一。数字 #cf_span[11000] 可以连续除以 #cf_span[2] 三次，得到数字 #cf_span[11]。剩下的操作是将数字加一（得到 #cf_span[100]），然后连续除以 #cf_span[2] 两次。最终，我们得到 #cf_span[1]。"}],"sample_group":[],"show_order":[],"formal_statement":"Let $ x $ be a positive integer given in binary representation.\n\nDefine the function $ f: \\mathbb{Z}^+ \\to \\mathbb{Z}^+ $ as:\n$$\nf(n) =\n\\begin{cases}\nn + 1 & \\text{if } n \\text{ is odd}, \\\\\nn / 2 & \\text{if } n \\text{ is even}.\n\\end{cases}\n$$\n\nLet $ a_0 = x $, and for $ i \\geq 0 $, define $ a_{i+1} = f(a_i) $.\n\nThe process terminates when $ a_k = 1 $ for some $ k \\in \\mathbb{N} $.\n\n**Objective:** Find the smallest $ k $ such that $ a_k = 1 $.\n\nGiven: $ x $ is provided as a binary string of length at most $ 10^6 $, with no leading zeros.\n\nCompute $ k $.","simple_statement":null,"has_page_source":false}