#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
	ll t;
	cin>>t;
	while(t--){
	    ll n,sum=0;
	    cin>>n;
	    ll a[n];
	    for(ll i=0;i<n;i++){
	        cin>>a[i];
	        sum+=a[i];
	    }
	    if(n==1){
	        cout<<0<<endl;
	    }else if(sum%n!=0){
	        cout<<-1<<endl;
	    }else{
	        ll e=sum/n;
	        ll ans =0;
	        for(ll i=0;i<n;i++){
	            if(a[i]>e){
	                ans++;
	            }
	        }
	        cout<<ans<<endl;
	    }
	}
	return 0;
}