#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
const long long M = 1000000007;
void dfs(long long st, vector<vector<long long> > &v, vector<bool> &vis,
         vector<long long> &a, vector<bool> &ans, vector<long long> &fans1,
         vector<long long> &fans2) {
  if (vis[st]) return;
  vis[st] = true;
  for (long long i = 0; i < v[st].size(); i++) {
    if (vis[v[st][i]]) continue;
    dfs(v[st][i], v, vis, a, ans, fans1, fans2);
  }
  long long tmp = 0;
  for (long long i = 0; i < v[st].size(); i++) {
    if (a[v[st][i]] > 0) {
      fans1.push_back(v[st][i] + 1);
      tmp += a[v[st][i]];
    } else
      fans2.push_back(v[st][i] + 1);
  }
  a[st] += tmp;
  return;
}
long long pow1(long long a, long long b, long long mod) {
  int res = 1;
  if (b < 0) b += mod - 1;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1;
  }
  return res % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    map<long long, long long> m;
    for (long long i = 0; i < n; i++) m[a[i]]++;
    map<long long, long long>::iterator it;
    long long cnt1 = 0;
    for (it = m.begin(); it != m.end(); it++) {
      cnt1 = max(cnt1, it->second);
    }
    long long ans1 = 0;
    for (it = m.begin(); it != m.end(); it++) {
      if (it->second == cnt1) ans1++;
    }
    long long tmp = ans1 * cnt1;
    tmp = n - tmp;
    long long fans = ans1 - 1 + tmp / (cnt1 - 1);
    cout << fans << endl;
  }
  return 0;
}
