#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, x;
  cin >> n;
  vector<int> arr(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr[x - 1]++;
  }
  int maxe = *max_element(arr.begin(), arr.end());
  int count_max = 0;
  for (int i = 0; i < n; i++) {
    if (maxe == arr[i]) count_max++;
  }
  int gap_remain = n - count_max * maxe;
  int gap_remain_each = gap_remain / (maxe - 1);
  cout << gap_remain_each + count_max - 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
    cout << "\n";
  }
  return 0;
}
