#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265359;
int counter[100001];
int main() {
  int t, n, most_freq, num_or_most_freq, x;
  cin >> t;
  while (t--) {
    cin >> n;
    most_freq = 0;
    memset(counter, 0, sizeof(counter));
    for (int i = 0; i < (int)(n); ++i) {
      cin >> x;
      counter[x]++;
      most_freq = max(most_freq, counter[x]);
    }
    num_or_most_freq = -1;
    for (int i = 0; i < (int)(100001); ++i)
      if (counter[i] == most_freq) num_or_most_freq++;
    if (most_freq == 1)
      cout << n << endl;
    else {
      n -= num_or_most_freq;
      int ans = (n - 1) / (most_freq - 1) + 1 - 2;
      if (ans <= 0)
        cout << 0 << endl;
      else
        cout << ans << endl;
    }
  }
  return 0;
}
