Given an array of integers, the task is to count minimum number of operations to equalize the array i.e., to make all array elements same. To equalize an array, we need to move values from higher numbers to smaller numbers. Number of operations is equal to number of movements.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains an Integer N denoting size of array and the second line contains N space separated elements.
For each test case, print the minimum number of operations. And print "-1", if it is not possible to equalize the array.
1 3 2 0 4
1 7 1