Your friend gifted you ‘N’ balls. Each ball has a number associated with it, the numbers associated with the balls are given in the array 'ARR'. But your cupboard has slots such that only N/2 balls can be kept. So, you decided to remove the balls following an operation.
In one operation, you can select a ball numbered ‘x’ and remove all the balls which are numbered ‘x’.
You are supposed to minimize the number of operations such that at least half of the balls are removed from ‘N’ balls.
Note:
Numbers on the balls may not be unique.
Input Format:
The first line of input contains an integer ‘T’, denoting the number of test cases. The test cases follow.
The first line contains integer ‘N’, which denotes the number of elements in the array ‘ARR’.
The second line contains N integers denoting the elements of the array ‘ARR’.
Output Format:
For each test case, return the minimum number of operations you need to perform to remove at least half of the balls.
Note:
You are not required to print the expected output, it has already been taken care of. Just implement the function.
Constraints:
1<= T <= 50
1 <= N <= 10^4
N is always even.
1 <= ARR[i] <= 10^9
Time Limit: 1 sec