{"raw_statement":[{"iden":"statement","content":"Nastya owns too many arrays now, so she wants to delete the least important of them. However, she discovered that this array is magic! Nastya now knows that the array has the following properties:\n\n*   In one second we can add an arbitrary (possibly negative) integer to all elements of the array that are not equal to zero.\n*   When all elements of the array become equal to zero, the array explodes.\n\nNastya is always busy, so she wants to explode the array as fast as possible. Compute the minimum time in which the array can be exploded."},{"iden":"input","content":"The first line contains a single integer _n_ (1 ≤ _n_ ≤ 105) — the size of the array.\n\nThe second line contains _n_ integers _a_1, _a_2, ..., _a__n_ ( - 105 ≤ _a__i_ ≤ 105) — the elements of the array."},{"iden":"output","content":"Print a single integer — the minimum number of seconds needed to make all elements of the array equal to zero."},{"iden":"examples","content":"Input\n\n5\n1 1 1 1 1\n\nOutput\n\n1\n\nInput\n\n3\n2 0 -1\n\nOutput\n\n2\n\nInput\n\n4\n5 -6 -5 1\n\nOutput\n\n4"},{"iden":"note","content":"In the first example you can add  - 1 to all non-zero elements in one second and make them equal to zero.\n\nIn the second example you can add  - 2 on the first second, then the array becomes equal to \\[0, 0,  - 3\\]. On the second second you can add 3 to the third (the only non-zero) element."}],"translated_statement":[{"iden":"statement","content":"Nastya 拥有太多数组了，因此她希望删除其中最不重要的一个。然而，她发现这个数组是神奇的！Nastya 现在知道该数组具有以下性质：\n\nNastya 总是很忙，因此她希望尽可能快地使数组“爆炸”。请计算使数组爆炸所需的最少时间。\n\n第一行包含一个整数 $n$ ($1 ≤ n ≤ 10^5$) —— 数组的大小。\n\n第二行包含 $n$ 个整数 $a_1, a_2, ..., a_n$ ($ - 10^5 ≤ a_i ≤ 10^5$) —— 数组的元素。\n\n请输出一个整数 —— 使数组中所有元素变为零所需的最少秒数。\n\n在第一个例子中，你可以在一秒钟内将 $-1$ 加到所有非零元素上，使它们变为零。\n\n在第二个例子中，你可以在第一秒添加 $-2$，此时数组变为 $[0, 0,  - 3]$。在第二秒，你可以将 $3$ 加到第三个（唯一非零）元素上。\n\n"},{"iden":"input","content":"第一行包含一个整数 $n$ ($1 ≤ n ≤ 10^5$) —— 数组的大小。第二行包含 $n$ 个整数 $a_1, a_2, ..., a_n$ ($ - 10^5 ≤ a_i ≤ 10^5$) —— 数组的元素。"},{"iden":"output","content":"请输出一个整数 —— 使数组中所有元素变为零所需的最少秒数。"},{"iden":"examples","content":"输入\n5\n1 1 1 1 1\n输出\n1\n\n输入\n3\n2 0 -1\n输出\n2\n\n输入\n4\n5 -6 -5 1\n输出\n4"},{"iden":"note","content":"在第一个例子中，你可以在一秒钟内将 $-1$ 加到所有非零元素上，使它们变为零。在第二个例子中，你可以在第一秒添加 $-2$，此时数组变为 $[0, 0,  - 3]$。在第二秒，你可以将 $3$ 加到第三个（唯一非零）元素上。"}],"sample_group":[],"show_order":[],"formal_statement":"Given an array $ a = [a_1, a_2, \\dots, a_n] $ of integers, define an operation as adding any real number $ x $ to all non-zero elements of the array in one second. The goal is to make all elements equal to zero in the minimum number of operations.\n\nLet $ S = \\{ a_i \\mid a_i \\ne 0 \\} $ be the set of non-zero elements.  \nLet $ T $ be the set of distinct non-zero values in $ a $.\n\n**Objective:**  \nMinimize the number of operations required to reduce all elements to zero, where in each operation, a single value $ x $ can be added to all current non-zero elements.\n\n**Key Insight:**  \nEach operation can eliminate one distinct non-zero value (by adding its negation), but only if all occurrences of that value are simultaneously targeted. Since adding the same $ x $ to all non-zero elements affects all distinct non-zero values simultaneously, the problem reduces to:  \nHow many distinct non-zero values must be eliminated?  \n\nEach operation can eliminate at most one distinct non-zero value (by choosing $ x = -v $ for some $ v \\in T $), and after that, $ v $ becomes zero and is no longer affected in future operations.\n\nThus, the minimum number of operations equals the number of distinct non-zero elements in the array.\n\n**Formal Statement:**\n\nLet $ a \\in \\mathbb{Z}^n $, with $ n \\geq 1 $, and $ a_i \\in [-10^5, 10^5] $.  \nDefine:  \n$$\nT = \\{ a_i \\mid a_i \\ne 0 \\}\n$$  \nThen the minimum number of operations required is:  \n$$\n|T|\n$$\n\n**Answer:**  \n$$\n\\boxed{|T|}\n$$","simple_statement":null,"has_page_source":false}