#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int find_ans(int n) {
  int y, cnt = 0;
  for (pair<int, int> x : mp) {
    y = ceil(x.second * 1.00 / n);
    if (y * (n - 1) > x.second) return INT_MAX;
    cnt += y;
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, n, t, x, mn, ans;
  cin >> t;
  while (t--) {
    cin >> n;
    mp.clear();
    for (i = 0; i < n; i++) cin >> x, ++mp[x];
    mn = n + 1, ans = INT_MAX;
    for (pair<int, int> y : mp) mn = min(mn, y.second + 1);
    for (i = mn; i > 0; i--) {
      ans = min(ans, find_ans(i));
      if (ans < INT_MAX) break;
    }
    cout << min(ans, n) << '\n';
  }
  return 0;
}
