#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    m[a]++;
  }
  vector<int> f;
  for (auto it : m) {
    f.push_back(it.second);
  }
  sort(f.begin(), f.end());
  long long ans = 1e9;
  for (int i = 1; i <= f[0] + 1; ++i) {
    long long cnt = 0;
    bool x = 1;
    for (int j = 0; j < f.size(); ++j) {
      int c = (f[j] / i) + (f[j] % i != 0);
      if (i - (f[j] % i) - 1 <= f[j] / i || (f[j] % i == 0)) {
        cnt += c;
      } else
        x = 0;
    }
    if (x) ans = min(ans, cnt);
  }
  cout << ans << endl;
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) solve();
}
