A. Against the Differencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output We define that a block is an array where all elements in it are equal to the length of the array. For example, $$$[3, 3, 3]$$$, $$$[1]$$$, and $$$[4, 4, 4, 4]$$$ are blocks, while $$$[1, 1, 1]$$$ and $$$[2, 3, 3]$$$ are not.An array is called neat if it can be obtained by the concatenation of an arbitrary number of blocks (possibly zero). Note that an empty array is always neat.You are given an array $$$a$$$ consisting of $$$n$$$ integers. Find the length of its longest neat subsequence$$$^{\text{∗}}$$$. $$$^{\text{∗}}$$$A sequence $$$c$$$ is a subsequence of a sequence $$$a$$$ if $$$c$$$ can be obtained from $$$a$$$ by the deletion of several (possibly, zero or all) element from arbitrary positions. InputEach test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2\cdot 10^5$$$) — the length of $$$a$$$.The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le n$$$) — the elements of $$$a$$$.It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot 10^5$$$. OutputFor each test case, output a single integer — the length of the longest neat subsequence of $$$a$$$.ExampleInput61122 242 2 1 161 2 3 3 3 188 8 8 8 8 8 8 7102 3 3 1 2 3 5 1 1 7Output1
2
4
5
0
5
NoteIn the first test case, the whole array $$$[1]$$$ is neat because it is a block.In the second test case, the whole array $$$[2, 2]$$$ is neat because it is a block.In the third test case, the whole array $$$[2,2,1,1]$$$ is neat because it is the concatenation of three blocks: $$$[2,2]$$$, $$$[1]$$$, and $$$[1]$$$.In the fourth test case, one of the longest neat subsequences of $$$a$$$ is $$$[1, 3, 3, 3, 1]$$$.In the fifth test case, the longest neat subsequence of $$$a$$$ is the empty subsequence.