Problems
Convert to permutation
Convert to permutation
You are given an array $A$ of size $n$. In one operation, you can choose an index $i~(1 \le i \le n)$ and increase $A_i$ by $1$.
Find the minimum number of operations required to convert the array $A$ into a permutation of size $n$. If it is impossible to do so, print $-1$.
Note that a permutation of size $n$ contains each element from $1$ to $n$ exactly once.
\InputFile
The first line contains a single integer $T$, denoting the number of test cases.
Each test case consists of multiple lines. The first line of each test case contains the integer $n~(1 \le n \le 1000)$ --- the size of the array. The next line contains $n$ integers, the elements of the array $A~(0 \le A_i \le 1000)$.
\OutputFile
For each test case, output on a new line, the minimum number of operations required to convert the array $A$ into a permutation of size $n$.
If it is impossible to do so, print $-1$.
Input example #1
4 4 3 1 1 2 3 0 3 3 3 3 2 1 3 2 0 1
Output example #1
3 -1 0 3