#include <bits/stdc++.h>
using namespace std;
void print(char *a) { cout << a << "\n"; }
void print(char *a, char *b) { cout << a << " " << b << "\n"; }
void print(char *a, char *b, char *d) {
  cout << a << " " << b << " " << d << "\n";
}
void print(char *a, char *b, char *c, char *d) {
  cout << a << " " << b << " " << c << " " << d << " "
       << "\n";
}
void print(int a) { cout << a << "\n"; }
void print(int a, int b) { cout << a << " " << b << "\n"; }
void print(int a, int b, int d) { cout << a << " " << b << " " << d << "\n"; }
void print(int a, int b, int c, int d) {
  cout << a << " " << b << " " << c << " " << d << " "
       << "\n";
}
void print(vector<char *> a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << "\n";
}
void print(vector<int> a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << "\n";
}
void print(int *a, int n) {
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
void print(vector<int> *a, int n) {
  for (int i = 0; i < n; i++) print(a[i]);
}
int arr[1000000];
int N;
void solve() {
  cin >> N;
  memset(arr, 0, sizeof(arr[0]) * N);
  int m = 0, k;
  for (int i = 0; i < N; i++) {
    cin >> k;
    arr[k - 1]++;
    m = max(m, arr[k - 1]);
  }
  k = 0;
  for (int i = 0; i < N; i++) {
    k += arr[i] == m;
  }
  cout << (N - k * m) / (m - 1) + (k - 1) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
