#include <bits/stdc++.h>
using namespace std;
int t, n, a[100001], cnta[100002], cntcnt[100001], got[100001], ngot, ans;
int main() {
  scanf("%d", &t);
  while (t--) {
    ans = 0;
    memset(cnta, 0, sizeof(cnta));
    memset(cntcnt, 0, sizeof(cntcnt));
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      cnta[a[i]]++;
    }
    sort(cnta, cnta + 100001, greater<int>());
    for (int i = 0; i < 100001; i++) {
      if (cnta[i] > 0)
        cntcnt[cnta[i]]++;
      else
        break;
    }
    int len, go = 0;
    for (int i = 0; i < 100001; i++) {
      if (cnta[i] == 0) break;
      if (i != 0 && cnta[i] == cnta[i - 1]) continue;
      if (i == 0) {
        ans = cntcnt[cnta[i]] - 1;
        len = cnta[i] - 1;
      } else {
        int all = cntcnt[cnta[i]] * cnta[i];
        while (all--) {
          go++;
          if (go == len) {
            go = 0;
            ans++;
          }
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
