#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  int n, x, k = 0, cnt = 0;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mp[x]++;
    k = max(mp[x], k);
  }
  for (auto it : mp) {
    if (it.second == k) cnt++;
  }
  cout << (n - cnt * k) / (k - 1) + cnt - 1 << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
