#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int n, q;
int a[100005];
int cnt[100005];
bool check(int x) {
  fill(cnt, cnt + 1 + n, 0);
  for (int i = 1; i <= n; ++i) {
    ++cnt[a[i]];
  }
  set<pair<int, int>, greater<pair<int, int>>> s;
  for (int i = 1; i <= n; ++i) {
    if (cnt[i] != 0) {
      s.insert({cnt[i], i});
    }
  }
  vector<int> v;
  v.push_back(0);
  for (int i = 1; i <= n; ++i) {
    if (i > x && cnt[v[i - x]] != 0) {
      s.insert({cnt[v[i - x]], v[i - x]});
    }
    if (s.empty()) {
      return false;
    }
    pair<int, int> p = *s.begin();
    s.erase(s.begin());
    v.push_back(p.second), --cnt[p.second];
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> q;
  while (q--) {
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
    }
    int l = 1, r = n, m;
    while (r - l > 1) {
      m = (l + r) >> 1;
      if (check(m)) {
        l = m;
      } else {
        r = m;
      }
    }
    cout << l - 1 << endl;
  }
  return 0;
}
