#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb(x) push_back(x)

int main()
{
    int n, t;
    cin >> n;

    for (int i = 0; i < n; ++i)
    {
        cin >> t;
        int arr[t], sum=0;
        
        for (int j = 0; j < t; ++j) {
            cin >> arr[j];
            sum += arr[j];
        }

        int result = 0;
        if(sum % t != 0) {
            cout << "-1" << endl;
        }
        else {
            for (int j = 0; j < t; ++j)
            {
                if((sum/t) - arr[j] < 0) result++;
            }
            cout << result << endl;
        }
    }
    
    return 0;
}
 