#include <bits/stdc++.h>
using namespace std;
long double pi = 3.141592653589793238;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    unordered_map<long long, long long> m1;
    for (long long i = 0; i < n; i++) {
      long long x;
      cin >> x;
      m1[x]++;
    }
    vector<long long> v1;
    for (auto i : m1) {
      v1.push_back(i.second);
    }
    sort((v1).begin(), (v1).end());
    long long end = v1[0] + 1;
    long long fin_ans = INT_MAX;
    for (long long s = 1; s <= end; s++) {
      long long ans = 0;
      long long fl = 0;
      for (long long i = 0; i < v1.size(); i++) {
        long long r1 = ceil((long double)v1[i] / (long double)s);
        long long r2 = r1 * (s - 1);
        if (v1[i] >= r2)
          continue;
        else {
          fl = 1;
          break;
        }
      }
      if (fl == 0) {
        for (long long i = 0; i < v1.size(); i++) {
          ans = ans + ceil((long double)v1[i] / (long double)s);
        }
        fin_ans = min(fin_ans, ans);
      }
    }
    cout << fin_ans << endl;
  }
}
