#include <bits/stdc++.h>
using namespace std;
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> second) {
  os << "{ ";
  for (auto s : second) os << s << " ";
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, multiset<T> second) {
  os << "{ ";
  for (auto s : second) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ") ";
  return os << "}";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " |";
  __f(comma + 1, args...);
}
void solve() {
  int n;
  cin >> n;
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    x--;
    c[x]++;
  }
  vector<int> f;
  for (int i = 0; i < n; ++i) {
    if (c[i]) f.push_back(c[i]);
  }
  sort(f.begin(), f.end());
  int sz = f[0] + 1, sc;
  while (true) {
    sc = 0;
    bool sol = true;
    for (int cnt : f) {
      if ((sz - cnt % sz) % sz > ceil(cnt / (double)sz)) sol = false;
      sc += ceil(cnt / (double)sz);
    }
    if (sol) break;
    sz--;
  }
  cout << sc << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1, tc = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
