#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1e5 + 5, inf = 1e9;
int n, a[maxn], last[maxn];
pair<int, int> cnt[maxn];
bool can(int mid) {
  priority_queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (cnt[i].first > 0) q.push(cnt[i].first);
  }
  vector<int> rem;
  for (int idx = 0; idx < n; idx++) {
    if (idx % mid == 0) {
      for (auto &p : rem) q.push(p);
      rem.clear();
    }
    if (q.empty()) return false;
    int v = q.top();
    q.pop();
    v--;
    if (v > 0) rem.emplace_back(v);
  }
  return true;
}
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      cnt[i].second = i;
      int x;
      scanf("%d", &x);
      cnt[x].first++;
    }
    int l = 1, r = n;
    while (l < r) {
      int mid = l + (r - l + 1) / 2;
      if (can(mid))
        l = mid;
      else
        r = mid - 1;
    }
    printf("%d\n", l - 1);
    for (int i = 1; i <= n; i++) cnt[i] = {0, 0};
  }
  return 0;
}
