{"raw_statement":[{"iden":"problem statement","content":"You are given a sequence of positive integers of length $N$, $a = (a_1, a_2, ..., a_N)$. Your objective is to remove some of the elements in $a$ so that $a$ will be a **good sequence**.\nHere, an sequence $b$ is a **good sequence** when the following condition holds true:\n\n*   For each element $x$ in $b$, the value $x$ occurs exactly $x$ times in $b$.\n\nFor example, $(3, 3, 3)$, $(4, 2, 4, 1, 4, 2, 4)$ and $()$ (an empty sequence) are good sequences, while $(3, 3, 3, 3)$ and $(2, 4, 1, 4, 2)$ are not.\nFind the minimum number of elements that needs to be removed so that $a$ will be a good sequence."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 10^5$\n*   $a_i$ is an integer.\n*   $1 \\leq a_i \\leq 10^9$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$a_1$ $a_2$ $...$ $a_N$"},{"iden":"sample input 1","content":"4\n3 3 3 3"},{"iden":"sample output 1","content":"1\n\nWe can, for example, remove one occurrence of $3$. Then, $(3, 3, 3)$ is a good sequence."},{"iden":"sample input 2","content":"5\n2 4 1 4 2"},{"iden":"sample output 2","content":"2\n\nWe can, for example, remove two occurrences of $4$. Then, $(2, 1, 2)$ is a good sequence."},{"iden":"sample input 3","content":"6\n1 2 2 3 3 3"},{"iden":"sample output 3","content":"0"},{"iden":"sample input 4","content":"1\n1000000000"},{"iden":"sample output 4","content":"1\n\nRemove one occurrence of $10^9$. Then, $()$ is a good sequence."},{"iden":"sample input 5","content":"8\n2 7 1 8 2 8 1 8"},{"iden":"sample output 5","content":"5"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}