#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
const int N = (int)1e6 + 3;
int A[2 * N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> A[i];
    map<int, int> M;
    for (int i = 0; i < n; ++i) M[A[i]]++;
    vector<int> X;
    for (auto x : M) {
      X.push_back(x.second);
    }
    sort(X.begin(), X.end(), greater<int>());
    int y = 0;
    for (int i = 0; i < X.size(); ++i)
      if (X[i] == X[0]) y++;
    int x = X[0];
    int ans = y + (n - y * x) / (x - 1);
    cout << ans - 1 << "\n";
  }
  return 0;
}
