#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int &i : a) i = 0;
    int d = 0;
    for (int i = 0; i < n; i++) {
      int k;
      cin >> k, a[k - 1]++, d += a[k - 1] == 1;
    }
    int b[d];
    int c = 0;
    for (int i = 0; i < n; i++)
      if (a[i]) b[c++] = a[i];
    sort(b, b + d, greater<int>());
    int l = 1, r = d;
    while (l <= r) {
      int m = (l + r) / 2;
      bool f = true;
      for (int i = 0; i < d; i++)
        if (b[i] > (n - i + m - 1) / m) {
          f = false;
          break;
        }
      if (f)
        l = m + 1;
      else
        r = m - 1;
    }
    cout << l - 2 << "\n";
  }
}
