text: #include <bits/stdc++.h>
  using namespace std;
  
  #ifdef LOCAL
  #include "/debug.h"
  #else
  #define db(...)
  #endif
  
  #define all(v) v.begin(), v.end()
  #define pb push_back
  using ll = long long;
  const int NAX = 2e5 + 5, MOD = 1000000007;
  
  void solveCase()
  {
      int n;
      cin >> n;
      vector<ll> a(n);
      for (auto &x : a)
          cin >> x;
      ll sum = accumulate(all(a), 0LL);
      if (sum % n)
      {
          cout << -1 << '\n';
          return;
      }
      sum /= n;
      sort(all(a));
      vector<int> b;
      for (auto &x : a)
          if (x > sum)
          {
              b.pb(x);
          }
      cout << b.size() << '\n';
  }
  
  int32_t main()
  {
  #ifndef LOCAL
      ios_base::sync_with_stdio(0);
      cin.tie(0);
  #endif
      int t = 1;
      cin >> t;
      for (int i = 1; i <= t; ++i)
          solveCase();
      return 0;
  }