candies-2

Given N bags of candies where each bag contains Ai number of candies in it. Your task is to use minimum number of steps to make number of candies in each bag equal. In each step you can remove one candy from any bag and transfer it to another bag.
Input
First line contains T number of test cases. First line of each test case contains N (number of bags). Next lines contains N integers separated by a single space.

Output
Print minimum number of steps to make candies in each bag equal in number. If it is impossible to make number of candies same in each bag print -1.
Constraints
1 ≤ T ≤ 10^4
1 ≤ N ≤ 10^4
1 ≤ Ai ≤ 10^9

SAMPLE INPUT
2
3
1 6 2
3
1 5 2

SAMPLE OUTPUT
3
-1

Source: hackerearth | Difficulty: EASY


Solutions: