#include <bits/stdc++.h>
using namespace std;
map<int, int> u;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    vector<int> v;
    int n;
    cin >> n;
    int ind = 0;
    for (int i = 1; i <= n; i++) {
      int a;
      cin >> a;
      if (u[a] == 0) v.push_back(a);
      u[a]++;
    }
    int mn = INT_MAX;
    for (int i = 0; i < v.size(); i++) {
      if (mn > u[v[i]]) mn = u[v[i]];
    }
    for (int s = mn + 1; s >= 1; s--) {
      int m = 0;
      int ind = 0;
      for (int i = 0; i < v.size(); i++) {
        int p = u[v[i]];
        int x;
        if (p % s == 0)
          x = p / s;
        else
          x = p / s + 1;
        int u = p - x * s;
        u = abs(u);
        if (u > x) {
          ind = 1;
          break;
        }
        if (p % s == 0)
          m += x;
        else
          m += x;
      }
      if (ind == 1) continue;
      cout << m << endl;
      break;
    }
    u.clear();
  }
}
