#include <bits/stdc++.h>
using namespace std;
const long long M = 998244353;
long long p[400001];
long long n;
vector<long long> a(100001);
bool check(long long x) {
  long long cnt[n + 1];
  for (int i = 1; i < n + 1; i++) cnt[i] = 0;
  for (int i = 0; i < n; i++) cnt[a[i]]++;
  set<pair<long long, long long>, greater<pair<long long, long long> > > ss;
  for (int i = 1; i < n + 1; i++) {
    if (cnt[i] > 0) ss.insert({cnt[i], i});
  }
  vector<long long> b;
  for (int i = 0; i < n; i++) {
    if (i >= x && cnt[b[i - x]] >= 1) {
      ss.insert({cnt[b[i - x]], b[i - x]});
    }
    if (ss.empty()) return false;
    b.push_back(ss.begin()->second);
    cnt[ss.begin()->second]--;
    ss.erase(ss.begin());
  }
  return true;
}
int main() {
  long long t;
  cin >> t;
  while (t-- > 0) {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    long long l = 0, h = n;
    long long ans;
    while (l + 1 < h) {
      long long mid = (l + h) / 2;
      if (check(mid)) {
        ans = mid;
        l = mid;
      } else
        h = mid;
    }
    cout << ans - 1 << endl;
  }
  return 0;
}
