#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  ;
  int t;
  cin >> t;
  ;
  while (t--) {
    int n;
    cin >> n;
    map<int, int> m;
    int mn = 1e9;
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      m[x]++;
    }
    vector<int> v;
    for (auto i : m) {
      v.push_back(i.second);
    }
    sort(v.begin(), v.end());
    mn = v[0];
    long long int ans = 1e9;
    for (int i = 1; i <= mn + 1; i++) {
      bool f = 1;
      long long int cnt = 0;
      for (int j = 0; j < v.size(); j++) {
        cnt += v[j] / i;
        if (v[j] % i and (v[j] % i + v[j] / i) >= i - 1)
          cnt++;
        else if (v[j] % i) {
          f = 0;
          break;
        }
      }
      if (f) ans = min(ans, cnt);
    }
    cout << ans << endl;
  }
  return 0;
}
