#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return ((power(x, y / 2)) * (power(x, y / 2)));
  else
    return (((x * (power(x, y / 2)))) * (power(x, y / 2)));
}
long long ceiling(long long d, long long x) {
  long long res = d / x;
  if (d % x != 0) res++;
  return res;
}
bool powerOfx(long long n, long long x) {
  long long count = 0;
  while (n % x == 0) {
    n /= x;
    count++;
  }
  if (n == 1) return true;
  return false;
}
long long maxArr(long long arr[], long long n) {
  long long max = arr[0];
  for (long long i = 0; i < n; i++) {
    if (max < arr[i]) max = arr[i];
  }
  return max;
}
long long minArr(long long arr[], long long n) {
  long long min = arr[0];
  for (long long i = 0; i < n; i++) {
    if (min > arr[i]) min = arr[i];
  }
  return min;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long pal(string s, long long l, long long r) {
  if (l > r)
    return 0;
  else if (l == r)
    return 1;
  else if (s[l] == s[r])
    return 2 + pal(s, l + 1, r - 1);
  else
    return max(pal(s, l, r - 1), pal(s, l + 1, r));
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    map<long long, long long> m;
    vector<long long> c;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      if (m[a[i]] == 0) c.push_back(a[i]);
      m[a[i]]++;
    }
    long long max = 0;
    long long count = 0;
    for (long long i = 0; i < c.size(); i++) {
      if (m[c[i]] > max) {
        max = m[c[i]];
        count = 1;
      } else if (m[c[i]] == max) {
        count++;
      }
    }
    long long res = (n - count * max) / (max - 1) + count - 1;
    cout << res << '\n';
  }
  return 0;
}
