#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
const long long INF = 1e18;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    unordered_map<long long, long long> mp;
    long long mini = INF;
    for (long long i = 0; i < n; i++) {
      long long a;
      cin >> a;
      mp[a]++;
    }
    for (auto& e : mp) {
      mini = min(mini, e.second);
    }
    long long ans = INF;
    for (long long i = 1; i <= mini + 1; i++) {
      long long fg = 1;
      long long curr = 0;
      for (auto& e : mp) {
        long long x = (e.second + i - 1) / i;
        long long y = e.second / i;
        y = i - e.second + y * i;
        if (y == i) {
          y = 0;
        }
        if (x < y) {
          fg = -1;
        } else {
          curr = curr + x;
        }
      }
      if (fg == 1) {
        ans = min(ans, curr);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
