#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int num[N];
bool v[N];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, ans = 0, cnt = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) num[i] = v[i] = 0;
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      num[x]++;
      ans = max(ans, num[x]);
    }
    for (int i = 1; i <= n; i++) {
      if (num[i] == ans) cnt++;
    }
    cout << (n - cnt * ans) / (ans - 1) + cnt - 1 << endl;
  }
}
