#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  int T;
  std::cin >> T;
  while (T--) {
    int N;
    std::cin >> N;
    std::vector<int> freq(N + 5);
    for (int i = 0, x; i < N; ++i) std::cin >> x, freq[x]++;
    int min = 0;
    for (int i = 1; i <= N; ++i) {
      if (min == 0) min = freq[i];
      if (freq[i] != 0) min = std::min(min, freq[i]);
    }
    int ans = 2000000005;
    for (int S = 2; S <= min + 1; ++S) {
      int sol = 0;
      bool bFlag = true;
      for (int j = 1; j <= N && bFlag; ++j)
        if (freq[j] > 0) {
          int q = (freq[j] - 1) / S + 1;
          if (freq[j] < q * (S - 1)) bFlag = false;
          sol += q;
        }
      if (bFlag) ans = std::min(ans, sol);
    }
    std::cout << ans << '\n';
  }
  return 0;
}
