#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    map<long long int, long long int> m;
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
      m[a[i]]++;
    }
    vector<long long int> v;
    set<long long int> s;
    for (auto it = m.begin(); it != m.end(); it++) {
      v.push_back((it->second));
      s.insert((it->second));
    }
    sort(v.begin(), v.end());
    auto uuu = s.begin();
    long long int o = (*uuu);
    o++;
    long long int k = s.size();
    bool f[k];
    memset(f, 0, k * sizeof(f[0]));
    long long int oo = 0;
    for (long long int i = 1; i <= o; i++) {
      long long int trig = 1;
      for (auto it = s.begin(); it != s.end(); it++) {
        long long int h = (*it);
        long long int yu = h / i;
        if (h % i == 0) {
          continue;
        }
        yu++;
        if (abs((yu * i) - h) > yu) {
          trig = 0;
        }
      }
      if (trig) {
        oo = max(oo, i);
      }
    }
    long long int out = 0;
    for (long long int i = 0; i < v.size(); i++) {
      out += v[i] / oo;
      if (v[i] % oo != 0) {
        out++;
      }
    }
    cout << out << "\n";
  }
  return 0;
}
