#include <bits/stdc++.h>
using namespace std;
const long long INF64 = 3e18;
const int mod = 998244353;
const int MAX_N = 100000 + 5;
long long binp(long long a, long long b) {
  if (b == 0) return 1;
  long long ans = binp(a, b / 2);
  long long tmp = (ans * ans);
  if (b % 2) return ((tmp * a));
  return ((tmp));
}
long long mbinp(long long a, long long b) {
  a %= mod;
  if (b == 0) return 1;
  long long ans = mbinp(a, b / 2);
  long long tmp = (ans * ans) % mod;
  if (b % 2) return ((tmp * a) % mod);
  return ((tmp) % mod);
}
void display(vector<long long> v) {
  for (auto x : v) cout << x << " ";
  cout << "\n";
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void here(long long a) { cout << "here " << a << endl; }
long long numlen(long long n) {
  long long ret = 1;
  while (n >= 10) {
    n /= 10;
    ret++;
  }
  return ret;
}
void qr(long long i, long long j) {
  cout << "? " << i << " " << j << '\n';
  cout.flush();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  for (long long _loop = 0; _loop < t; _loop++) {
    long long n;
    cin >> n;
    map<long long, long long> occ;
    for (long long i = 0; i < n; i++) {
      long long d;
      cin >> d;
      occ[d]++;
    }
    long long minocc = INF64;
    for (auto x : occ) minocc = min(minocc, x.second);
    long long minim = INF64;
    for (long long s = 1; s < minocc + 2; s++) {
      bool valid = true;
      long long tmpm = 0;
      for (auto z : occ) {
        long long nbm = z.second / s + (z.second % s != 0);
        if (z.second < nbm * (s - 1)) {
          valid = false;
          break;
        }
        tmpm += nbm;
      }
      if (valid) minim = min(minim, tmpm);
    }
    cout << minim << '\n';
  }
}
