Once upon a time, Attal was playing with an array and applying some operations on it. But during his playing, he noticed that he hates the array if it's elements are not the same.
Attal was a lazy man. So he gives Yaman the array $$$a$$$ that contains $$$n$$$ integers $$$[a_1, a_2, ... a_n]$$$, and he asks Yaman to make their elements equal using two kinds of operations:
Note that the number $$$k$$$ can be different in each operation.
Yaman wants to make the array's elements equal using the minimum number of operations (possibly zero). Help Yaman to find it.
The first line contains the number of test cases $$$t$$$ $$$( 1 \le t \le 10^{5} )$$$. A description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ $$$( 1 \le n \le 10^{6} )$$$, — the length of the array $$$a$$$.
The next line contains $$$n$$$ integers $$$a_i$$$ $$$( 1 \le a_i \le n)$$$, — the array $$$a$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^{6}$$$.
Print the minimum number of operations needed to make the elements of the array $$$a$$$ equal.
331 2 341 2 2 433 3 3
2 2 0
| Name |
|---|


