#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll lp = 1000000007 ;

long long int power(ll a, ll b){
    ll temp;
    if(b==0){return 1;}
    temp = power(a,b/2)%lp; 
    if(b%2==0){return (temp*temp)%lp;}
    else {return (((a*temp)%lp)*temp)%lp;}}

int main() {
    
    int t;
    cin>>t;
    for(int tt = 0 ; tt<t ;tt++){
        int k;
        cin>>k;
        int l[k];
        int sum=0;

        for(int i = 0 ; i < k ; i++){
            cin>>l[i];
            sum+=l[i];
        }

        int avg = sum/k;

        if(avg*k!=sum){
            cout<<-1<<endl;
            continue;
        }
        int count=0;
        for(int i = 0 ; i < k ; i++){
            if(l[i]>avg)
                count++;
        }
        cout<<count<<endl;



    }
    return 0;
}