#include <bits/stdc++.h>
using namespace std;
bool prime[1000005];
int num[1000005];
void Sieve(int n) {
  memset(prime, true, n);
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, x, m, n, h = 0;
  cin >> t;
  while (t--) {
    cin >> n;
    long long int ar[n];
    long long int mi = INT_MAX;
    map<long long int, long long int> mp;
    for (long long int i = 0; i < n; i++) {
      cin >> ar[i];
      mp[ar[i]]++;
      mi = min(mi, ar[i]);
    }
    vector<pair<long long int, long long int>> v;
    for (auto i : mp) {
      v.push_back(make_pair(i.second, i.first));
    }
    sort(v.begin(), v.end());
    long long int l = 1, r = v[0].first + 1;
    long long int sz = 0, mx = INT_MAX;
    for (long long int mid = 1; mid <= r; mid++) {
      long long int sum = 0;
      long long int f = 1;
      for (long long int i = 0; i < v.size(); i++) {
        long long int fr = v[i].first;
        long long int a = fr / mid;
        long long int b = fr % mid;
        if (a + b < (mid - 1) && b != 0) {
          f = 0;
          break;
        }
        sum += ceil(fr / (mid));
        if (fr % mid != 0) sum++;
      }
      if (f) {
        mx = min(mx, sum);
      }
    }
    cout << mx << "\n";
  }
}
