#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000005;
int b[maxn], a[maxn], cnt;
bool pd(int x, int y) {
  if (x == 1) return 1;
  return y / (x - 1) >= y % (x - 1);
}
int main() {
  ios::sync_with_stdio(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cnt = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) a[i] = b[i] = 0;
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      b[x]++;
    }
    int mx = 0;
    for (int i = 1; i <= n; i++) {
      if (b[i]) a[++cnt] = b[i];
      mx = max(mx, a[cnt]);
    }
    for (int i = mx; i >= 1; i--) {
      int flag = 1;
      for (int j = 1; j <= cnt; j++) {
        if (!pd(i, a[j])) {
          flag = 0;
          break;
        }
      }
      if (flag) {
        int ans = 0;
        for (int j = 1; j <= cnt; j++) ans += (a[j] - 1) / i + 1;
        cout << ans << endl;
        break;
      }
    }
  }
  return 0;
}
