P14795 [CodeChef] RECSTI
普及
题目描述

MoEngage has a bundle of N sticks. The i^{th} stick has a length L_{i} meters.

Find the minimum number of sticks (of any length) you need to add to the bundle such that you can construct some [rectangles] where each stick of the bundle belongs to exactly one rectangle and each side of a rectangle should be formed with exactly one stick.

------ Input Format ------

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first line of each test case contains a single integer N, denoting the number of given sticks.
  • The second line of each test case contains $N space-separated integers L_{1}, L_{2}, \dots, L_{N},$ denoting the length of the sticks.

------ Output Format ------

For each test case, output in a single line, the minimum number of sticks you need to add to the bundle to satisfy the given conditions.

------ Constraints ------

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 100$
$1 ≤ L_{i} ≤ 100$

----- Sample Input 1 ------
4
1
1
2
2 5
4
2 2 3 3
7
1 3 5 7 1 7 5

----- Sample Output 1 ------
3
2
0
1

----- explanation 1 ------
Test case $1$: One possible way is to add $3$ sticks with lengths $1, 2,$ and $2$. Now, it is possible to construct a rectangle with one pair of opposite sides having a length of $1$ and another pair of opposite sides having a length of $2$.

Test case $2$: The optimal way is to add $2$ sticks with lengths $2$ and $5$. Now, it is possible to construct a rectangle with one pair of opposite sides having a length of $2$ and another pair of opposite sides having a length of $5$.

Test case $3$: There is no need to add more sticks to the bundle as it is possible to construct a rectangle using the given sticks.

输入格式

见题面

输出格式

见题面

样例输入
4 1 1 2 2 5 4 2 2 3 3 7 1 3 5 7 1 7 5
样例输出
3 2 0 1