#include <bits/stdc++.h>
using namespace std;
void lc() { cout << endl; }
long long md(long long n) { return n % 1000000007; }
long long n, a[100001];
bool ispossible(long long k) {
  long long cnt[100001];
  memset(cnt, 0, sizeof(cnt));
  for (long long i = 0; i < n; i++) cnt[a[i]]++;
  set<pair<long long, long long>, greater<pair<long long, long long>>> st;
  for (long long i = 0; i < 100001; i++)
    if (cnt[i] > 0) st.insert({cnt[i], i});
  vector<long long> b;
  for (long long i = 0; i < n; i++) {
    if (i >= k + 1 and cnt[b[i - k - 1]]) {
      st.insert({cnt[b[i - k - 1]], b[i - k - 1]});
    }
    if (st.empty()) return false;
    b.push_back(st.begin()->second);
    st.erase(st.begin());
    cnt[b.back()]--;
  }
  return true;
}
void solve() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long i = 0, j = n, ans = 0;
  while (i <= j) {
    long long mid = (i + j) / 2;
    if (ispossible(mid))
      i = mid + 1;
    else
      j = mid - 1;
  }
  cout << j;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    lc();
  }
}
