You are given an integer array A consisting of N elements. You can perform the following operations on array A:
You are required to spend the minimum number of coins in order to make all the elements in array A equal.
Input format
Output format
Print T lines. For each test case, print a single line denoting the minimum number of coins to make all elements equal.
Constraints
1≤T≤20000
1≤N≤100000
1≤Ai≤109∀i∈[1,N]
Sum of N over all test cases does not exceed 500000
We can make all elements equal to 3 in 1 coin which is optimal.