#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1E5 + 10;
int num[MAXN];
int main() {
  int cas;
  scanf("%d", &cas);
  while (cas--) {
    int n;
    int big = 0, group = 0;
    memset(num, 0, sizeof(num));
    scanf("%d", &n);
    for (int a, i = 1; i <= n; ++i) {
      scanf("%d", &a);
      ++num[a];
      if (num[a] > big) {
        big = num[a];
        group = 1;
      } else if (num[a] == big) {
        ++group;
      }
    }
    int ans = (n - big * group) / (big - 1);
    ans = ans + group - 1;
    printf("%d\n", ans);
  }
  return 0;
}
