#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t, n, i, j, k, a, b, c, ans, x;
  cin >> t;
  while (t--) {
    cin >> n;
    map<int, int> ct;
    for (i = 0; i < n; i++) {
      cin >> x;
      ct[x]++;
    }
    vector<int> v;
    for (auto p : ct) v.push_back(p.second);
    a = 1;
    b = n;
    while (a < b) {
      c = (a + b + 1) / 2;
      vector<vector<int>> vv(n + 1);
      priority_queue<int> pq;
      for (auto p : v) pq.push(p);
      bool valid = true;
      for (i = 0; i < n; i++) {
        for (auto p : vv[i]) pq.push(p);
        if (pq.empty()) {
          valid = false;
          break;
        }
        x = pq.top();
        pq.pop();
        if (x > 1) {
          if (i + c >= n) {
            valid = false;
            break;
          }
          vv[i + c].push_back(x - 1);
        }
      }
      if (valid)
        a = c;
      else
        b = c - 1;
    }
    cout << a - 1 << "\n";
  }
  return 0;
}
