#include <bits/stdc++.h>
using namespace std;
const long long int MAX_N = 3e5 + 5;
const long long int mod = 1e9 + 7;
int arr[MAX_N];
map<int, int> mark;
void solve() {
  mark.clear();
  int N, M;
  scanf("%d", &N);
  int maxx = 0;
  int cnt = 0;
  for (register int i = 1; i <= N; ++i) {
    scanf("%d", &arr[i]);
    mark[arr[i]]++;
    if (mark[arr[i]] > maxx) {
      maxx = max(maxx, mark[arr[i]]);
      cnt = 0;
    }
    if (mark[arr[i]] == maxx) {
      cnt++;
    }
  }
  if (maxx == 1) {
    puts("0");
  } else {
    cout << (N - maxx * cnt) / (maxx - 1) + cnt - 1 << endl;
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
