#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    int c[n + 5];
    memset(c, 0, sizeof(c));
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      c[x]++;
    }
    vector<int> v;
    for (int i = 1; i <= n; i++) {
      if (c[i] > 0) v.push_back(c[i]);
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    if (v.size() == 1) {
      cout << 0 << endl;
      continue;
    }
    int cnt = 0, maxi = 0;
    for (int i = 0; i < v.size(); i++) {
      if (v[i] == v[0]) cnt++;
    }
    cout << (n - v[0] * cnt) / (v[0] - 1) + cnt - 1 << endl;
  }
  return 0;
}
