#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second < b.second)
    return true;
  else
    return false;
}
bool sortbyboth(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first < b.first)
    return true;
  else if (a.first == b.first)
    return a.second < b.second;
  else
    return false;
}
bool sortff_resortss(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first < b.first)
    return true;
  else if (a.first == b.first)
    return a.second > b.second;
  else
    return false;
}
bool sortbystring(const string &a, const string &b) {
  string c = a + b;
  string d = b + a;
  if (c >= d)
    return true;
  else
    return false;
}
class CompareDist {
 public:
  bool operator()(pair<int, pair<int, int>> a, pair<int, pair<int, int>> b) {
    if (a.first < b.first)
      return true;
    else if (a.first == b.first)
      return a.second.first > b.second.first;
    else
      return false;
  }
};
long long modi(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long Logn(long long n, long long r) {
  return (n > r - 1) ? 1 + Logn(n / r, r) : 0;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modinv(long long n, long long p) { return power(n, p - 2, p); }
long long ncr(long long n, long long r, long long p) {
  if (r == 0) return 1;
  int n1 = n;
  long long fac[n1 + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modinv(fac[r], p) % p * modinv(fac[n - r], p) % p) % p;
}
int spf[10000001];
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < 10000001; i++) spf[i] = i;
  for (int i = 4; i < 10000001; i += 2) spf[i] = 2;
  for (int i = 3; i * i < 10000001; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < 10000001; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<int> getFactorization(int x) {
  vector<int> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    x = x / spf[x];
  }
  return ret;
}
bool isPowerOfTwo(int x) { return (x && !(x & (x - 1))); }
int count_one(int n) {
  int count = 0;
  while (n) {
    n = n & (n - 1);
    count++;
  }
  return count;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n + 1, 0);
    int max1 = INT_MIN;
    for (int i = 0; i < n; i++) {
      int a1;
      cin >> a1;
      a[a1]++;
      max1 = max(max1, a[a1]);
    }
    if (max1 == 2) {
      int cnt = 0;
      for (int i = 1; i <= n; i++) {
        if (a[i] == max1) cnt++;
      }
      cout << (n - cnt) - 1 << endl;
    } else {
      int r = (n - max1);
      int cnt = 0;
      for (int i = 1; i <= n; i++) {
        if (a[i] == max1) cnt++;
      }
      r -= (cnt - 1);
      int gap = r / (max1 - 1);
      cout << gap << endl;
    }
  }
  return 0;
}
