#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll test;
    cin >> test;
    while (test--)
    {
        ll a, sum = 0, average = 0, count = 0;
        cin >> a;
        ll arr[a];
        for (int i = 0; i < a; i++)
        {
            cin >> arr[i];
            sum += arr[i];
        }
        if (sum % a == 0)
        {
            if (a > 1)
            {
                average = sum / a;
                for (int i = 0; i < a; i++)
                {
                    if (arr[i] > average)
                    {
                        count++;
                    }
                }
                cout << count << endl;
            }
            else
            {
                cout << 0 << endl;
            }
        }
        else
        {
            cout << -1 << endl;
        }
    }
}