#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> cnt(n + 1, 0);
    int maxCnt = 0;
    for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      cnt[a]++;
      maxCnt = max(maxCnt, cnt[a]);
    }
    int totalMaxCnt = 0, totalNonMaxCnt = 0;
    for (int i = 1; i <= n; i++) {
      totalMaxCnt += cnt[i] == maxCnt;
      totalNonMaxCnt += (cnt[i] != maxCnt) * cnt[i];
    }
    cout << (totalMaxCnt - 1) + totalNonMaxCnt / (maxCnt - 1) << endl;
  }
  return 0;
}
