{"raw_statement":[{"iden":"statement","content":"Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.\n\nThe ticket is considered lucky if the sum of first three digits equals to the sum of last three digits."},{"iden":"input","content":"You are given a string consisting of 6 characters (all characters are digits from 0 to 9) — this string denotes Luba's ticket. The ticket can start with the digit 0."},{"iden":"output","content":"Print one number — the minimum possible number of digits Luba needs to replace to make the ticket lucky."},{"iden":"examples","content":"Input\n\n000000\n\nOutput\n\n0\n\nInput\n\n123456\n\nOutput\n\n2\n\nInput\n\n111000\n\nOutput\n\n1"},{"iden":"note","content":"In the first example the ticket is already lucky, so the answer is 0.\n\nIn the second example Luba can replace 4 and 5 with zeroes, and the ticket will become lucky. It's easy to see that at least two replacements are required.\n\nIn the third example Luba can replace any zero with 3. It's easy to see that at least one replacement is required."}],"translated_statement":[{"iden":"statement","content":"Luba 有一张由 #cf_span[6] 位数字组成的票。在一次操作中，她可以选择任意位置的数字并将其替换为任意数字。她想知道最少需要替换多少个数字，才能使这张票变成幸运票。\n\n当且仅当前三个数字的和等于后三个数字的和时，这张票被认为是幸运的。\n\n给你一个由 #cf_span[6] 个字符组成的字符串（所有字符都是从 #cf_span[0] 到 #cf_span[9] 的数字）——该字符串表示 Luba 的票。票的首位可以是数字 #cf_span[0]。\n\n请输出一个数字——Luba 为使票变成幸运票所需替换的最少数字个数。\n\n在第一个例子中，票已经是幸运的，因此答案是 #cf_span[0]。\n\n在第二个例子中，Luba 可以将 #cf_span[4] 和 #cf_span[5] 替换为零，票就会变成幸运的。显然至少需要两次替换。\n\n在第三个例子中，Luba 可以将任意一个零替换为 #cf_span[3]。显然至少需要一次替换。\n\n"},{"iden":"input","content":"给你一个由 #cf_span[6] 个字符组成的字符串（所有字符都是从 #cf_span[0] 到 #cf_span[9] 的数字）——该字符串表示 Luba 的票。票的首位可以是数字 #cf_span[0]。"},{"iden":"output","content":"请输出一个数字——Luba 为使票变成幸运票所需替换的最少数字个数。"},{"iden":"examples","content":"输入000000输出0输入123456输出2输入111000输出1"},{"iden":"note","content":"在第一个例子中，票已经是幸运的，因此答案是 #cf_span[0]。在第二个例子中，Luba 可以将 #cf_span[4] 和 #cf_span[5] 替换为零，票就会变成幸运的。显然至少需要两次替换。在第三个例子中，Luba 可以将任意一个零替换为 #cf_span[3]。显然至少需要一次替换。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T = d_1 d_2 d_3 d_4 d_5 d_6 $ be a string of 6 digits, where $ d_i \\in \\{0, 1, \\dots, 9\\} $ for $ i = 1, \\dots, 6 $.  \nDefine:  \n- $ S_L = d_1 + d_2 + d_3 $: sum of the first three digits.  \n- $ S_R = d_4 + d_5 + d_6 $: sum of the last three digits.  \n\n**Constraints**  \nEach digit $ d_i \\in \\{0, 1, \\dots, 9\\} $.  \n\n**Objective**  \nFind the minimum number of digit replacements required such that $ S_L = S_R $.  \nEach replacement allows changing any digit $ d_i $ to any value in $ \\{0, 1, \\dots, 9\\} $.","simple_statement":null,"has_page_source":false}