#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define sz(x) (int((x).size()))
const int MAXN = 2e5 + 5; 

int n;
LL a[MAXN];

int solve() {
    LL sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
    }
    if (sum % n != 0) {
        return -1;
    }

    LL target = sum / n;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > target) {
            ans++;
        }
    }
    return ans;
}

int main() { IOS
    int T;
    cin >> T;
    while (T--) {
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        cout << solve() << "\n";
    }
}