#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast")
using namespace std;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
const int inf = 1e9 + 7;
const long long INF = INT64_MAX;
double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 1;
const double pi = acos(-1.0);
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
void add(long long& a, long long b) {
  a += b;
  ((a >= mod) && (a -= mod));
  ((a < 0) && (a += mod));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int _;
  cin >> _;
  while (_--) {
    int n;
    cin >> n;
    map<int, int> mp;
    int mx = 0;
    for (int i = 1; i <= n; ++i) {
      int a;
      cin >> a;
      mp[a]++;
      mx = max(mx, mp[a]);
    }
    int num = 0;
    for (auto it : mp) {
      if (it.second == mx) num++;
    }
    cout << (n - num * mx) / (mx - 1) + num - 1 << '\n';
  }
}
