#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int arr[100001];
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    int mx_count = 0;
    int db = 0;
    for (int i = 0; i < 100001; i++) {
      arr[i] = 0;
    }
    for (int j = 0; j < n; j++) {
      int a;
      cin >> a;
      arr[a] += 1;
      if (arr[a] > mx_count) {
        mx_count = arr[a];
        db = 0;
      } else if (arr[a] == mx_count) {
        db += 1;
      }
    }
    int ans = 0;
    if (db > 0 && mx_count == 2) {
      ans += (n - (mx_count * (db + 1))) + db;
    } else {
      ans += floor((n - mx_count * (db + 1)) / (mx_count - 1)) + db;
    }
    cout << ans << endl;
  }
  return 0;
}
