#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
using namespace std;
#define ll long long int
#define ld long double
#define mod (ll)(1e9+7)
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forab(i,a,b) for(ll i=a;i<=b;i++)
#define vll vector<ll>
#define pb(i) push_back(i)
#define fio ios_base::sync_with_stdio(false),cin.tie(NULL)
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll>,greater<ll>>

const ll inf = 1e9 + 7;

ll mult(ll a, ll b, ll p) {return ((a % p) * (b % p)) % p;}
ll add(ll a, ll b, ll p) {return (a % p + b % p) % p;}
ll fpow(ll n, ll k, ll p) {
	ll r = 1;
	for (; k; k >>= 1) {
		if (k & 1) r = r * n % p;
		n = n * n % p;
	}
	return r;
}
ll gcd(ll a, ll b) {if (a == 0) return b; return gcd(b % a, a);}
ll max(ll a, ll b) {if (a > b) return a; else return b;}
ll min(ll a, ll b) {if (a < b) return a; else return b;}

// Code

void solve() {

	ll n;
	cin >> n;

	vll a(n);
	ll sum = 0;

	for0(i, n) {
		cin >> a[i];
		sum += a[i];
	}

	if (sum % n != 0) {
		cout << "-1\n";
		return;
	}

	sum = sum / n;

	ll count = 0;

	for0(i, n) {
		if (a[i] > sum) count++;
	}

	cout << count << "\n";

}

int main()
{

	fio;

	ll t = 1;
	cin >> t;

	while (t--) {

		solve();

	}

	return 0;

}