#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MAX = 1e5 + 10;
int N;
vector<int> A;
bool check(int K) {
  if (A.size() < K) return 0;
  bool ok = 1;
  for (int i = 0; i < K; i++) {
    int x = N / K;
    if (i < N % K) x++;
    ok &= (x >= A[i]);
  }
  return ok;
}
void test_case() {
  cin >> N;
  A.assign(N + 1, 0);
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    A[x]++;
  }
  sort((A).begin(), (A).end(), greater<int>());
  int it = 0;
  for (int i = 0; i < MAX; i++) {
    if (!it && !A[i]) it = i;
  }
  A.erase(A.begin() + it, A.end());
  int l = 1, r = N;
  while (l < r) {
    int m = l + (r - l + 1) / 2;
    if (check(m))
      l = m;
    else
      r = m - 1;
  }
  cout << l - 1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tt = 1;
  cin >> tt;
  while (tt--) {
    test_case();
  }
  return 0;
}
