#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> a;
void reset() { a.clear(); }
void input() {
  cin >> n;
  int c;
  for (int(i) = (0); (i) < (n); ++i) {
    cin >> c;
    a[c]++;
  }
}
bool check(int s) {
  for (auto it = a.begin(); it != a.end(); ++it) {
    double b = (double)(it->second);
    if ((int)ceil(b / s) != (int)floor(b / (s - 1))) {
      return false;
    }
  }
  return true;
}
void process() {
  double d = (double)n;
  int mn = n + 1;
  for (auto it = a.begin(); it != a.end(); ++it) mn = min(mn, it->second);
  int m = n + 1;
  for (int(s) = (2); (s) < (mn + 2); ++s) {
    bool ok = true;
    int tmp = 0;
    for (auto it = a.begin(); it != a.end(); ++it) {
      int f = it->second;
      int q = (int)ceil(1.0 * f / s);
      if (f < q * (s - 1)) {
        ok = false;
        break;
      }
      tmp += q;
    }
    if (ok) m = min(m, tmp);
  }
  cout << m << '\n';
}
void solve() {
  reset();
  input();
  process();
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
