#include <bits/stdc++.h>
using namespace std;
long long divUp(long long a, long long b) {
  if (a % b == 0) return a / b;
  return a / b + 1;
}
bool valid(long long c, long long s) { return divUp(c, s) >= (s - c % s) % s; }
void solve() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < (int)n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  int i = 0;
  long long ans = 1e18;
  vector<long long> C;
  long long minCnt = 1e9;
  while (i < v.size()) {
    int x = v[i];
    long long cnt = 0;
    while (i < v.size() && x == v[i]) {
      cnt++;
      i++;
    }
    C.push_back(cnt);
    minCnt = min(minCnt, cnt);
  }
  for (long long s = 1; s <= minCnt + 1; s++) {
    long long cur = 0;
    bool ok = true;
    for (long long c : C) {
      if (!valid(c, s)) {
        ok = false;
        break;
      }
      cur += divUp(c, s);
    }
    if (ok) {
      ans = min(ans, cur);
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  for (int t = 0; t < (int)T; t++) {
    solve();
  }
  return 0;
}
