#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> counts;
int solve();
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    counts.clear();
    cin >> n;
    for (int i = 0; i < n; i++) {
      int c;
      cin >> c;
      if (counts.find(c) == counts.end())
        counts[c] = 1;
      else
        counts[c]++;
    }
    cout << solve() << "\n";
  }
  return 0;
}
int solve() {
  vector<int> counts_v;
  int cmin = numeric_limits<int>::max();
  for (auto it = counts.begin(); it != counts.end(); it++) {
    counts_v.push_back(it->second);
    cmin = min(cmin, it->second);
  }
  for (int s = cmin + 1; s > 0; s--) {
    bool possible = true;
    int total = 0;
    for (auto count : counts_v) {
      int a = count / s;
      if (count % s > 0) a++;
      if (a * s - count > a) {
        possible = false;
        break;
      } else {
        total += a;
      }
    }
    if (possible) return total;
  }
  return -1;
}
