#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  map<int, int> cnt;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mx = max(mx, ++cnt[x]);
  }
  vector<int> res;
  for (auto i : cnt) res.push_back(i.second);
  sort(res.rbegin(), res.rend());
  int t_len = 0;
  int ans = 0;
  for (int i = 1; i < res.size(); i++) {
    if (res[i] == res[0]) --res[i];
    t_len += res[i];
    if (t_len >= res[0] - 1) {
      ++ans;
      t_len -= res[0] - 1;
    }
  }
  if (t_len == res[0] - 1) ++ans;
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
