Bob and Alice are two friends, they have an array \(A\) consisting of \(N\) integers, \(A_1, A_2, A_3\ ...,\ A_N\). Alice likes the arrays in which if element \(X\) is present it must have exactly \(X\) or zero occurrences. So, Bob has decided to convert this array to an array which Alice likes. To do that, he can perform the following two operations:
Find the minimum number of operations Bob has to perform so that array is liked by Alice.
Input format
Output format
Print \(T\) lines. For each test case:
Constraints
\(1 \leq T \leq 20000\)
\(1 \leq N \leq 200000\)
\(1 \leq A_i \leq 10^9 \forall i \in [1,N]\)
The sum of \(N\) over all test cases does not exceed 200000.
According to the defination: 1 should have exactly one or zero occurence, 2 should have two or zero occurences and 3 should have three or zero occurences.
So for three, we have two options, either we remove both occurences or add one occurence, it will be optimal to add one occurence.