#include <bits/stdc++.h>
using namespace std;
int solve() {
  int n;
  cin >> n;
  map<int, int> freq;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    freq[d]++;
  }
  vector<int> f;
  for (auto it = freq.begin(); it != freq.end(); it++) {
    f.push_back(it->second);
  }
  int min_a = n;
  for (int i = 2; i <= f[0] + 1; i++) {
    int min_l = 0;
    for (int j = 0; j < (int)f.size(); j++) {
      if (((f[j] + i - 1) / i) * (i - 1) <= f[j]) {
        min_l += (f[j] + i - 1) / i;
      } else {
        min_l = 1e9;
        break;
      }
    }
    min_a = min(min_l, min_a);
  }
  return min_a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int tt;
  cin >> tt;
  while (tt--) {
    cout << solve() << '\n';
  }
  return 0;
}
