#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k = 0, t = 0, sum = 0, cnt = 0;
  cin >> n;
  unordered_map<long long, long long> mp;
  for (int i = 0; i < n; i++) {
    cin >> k;
    mp[k]++;
    t = max(t, mp[k]);
  }
  for (auto x : mp) {
    if (x.second == t) cnt++;
  }
  long long z = n - cnt * t;
  cout << cnt - 1 + (z) / (t - 1) << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, tests = 1, prev = 0, i = 0;
  cin >> tests;
  while (tests--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  std::mt19937_64 rng(
      std::chrono::steady_clock::now().time_since_epoch().count());
  return 0;
}
