#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int max = 1e5 + 5;
  while (t--) {
    int n;
    cin >> n;
    vector<int> count(max, 0);
    vector<int> a(n);
    int maxm = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      count[a[i]]++;
      if (count[a[i]] > maxm) {
        ans = 1;
        maxm = count[a[i]];
      } else if (count[a[i]] == maxm)
        ans++;
    }
    cout << ((n - ans * maxm) / (maxm - 1)) + (ans - 1) << "\n";
  }
}
