#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    map<int, int> d, e;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      d[x]++;
    }
    for (auto x : d) e[x.second]++;
    vector<pair<int, int>> a(e.begin(), e.end());
    int c = 0, ans = a.back().second - 1;
    for (int i = 0; i < a.size() - 1; i++) c += a[i].first * a[i].second;
    ans += c / (a.back().first - 1);
    cout << ans << endl;
  }
  return 0;
}
