#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t-- > 0) {
    int n;
    cin >> n;
    vector<int> c(100023);
    for (int i = 0; i < n; ++i) {
      int a;
      cin >> a;
      ++c[a];
    }
    sort(c.rbegin(), c.rend());
    int l = 2, r = n;
    while (l < r) {
      int m = (l + r) / 2;
      list<int> b(n / m, m);
      if (n % m > 0) b.push_back(n % m);
      bool can = true;
      auto it = b.begin();
      for (int k : c) {
        if (k == 0) break;
        if (k > (int)b.size()) {
          can = false;
          break;
        }
        while (k-- > 0) {
          if (--*it == 0)
            it = b.erase(it);
          else
            ++it;
          if (it == b.end()) it = b.begin();
        }
      }
      if (can)
        l = m + 1;
      else
        r = m;
    }
    cout << l - 2 << '\n';
  }
  return 0;
}
