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

void solve() {
    int n;
    cin>>n;
    
    int sum = 0, k = 0;
    int a[n];
    for(int i=0; i<n; i++) {
        cin>>a[i];
        sum += a[i];
    }
    

    if(sum%n == 0) {
        int tmp = sum/n;
        for(int i=0; i<n; i++) {
            if(a[i] > tmp) {
                k++;
            }
        }
        cout<<k<<endl;
    }
    else {
        cout<<-1<<endl;
    }
}

int main()
{
    int t;
    cin>>t;
    while(t--) {
        solve();
    }
    return 0;
}