#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 2100031;
int tests;
int n;
int cnt[N];
vector<int> interesting;
int solver(int screen_size) {
  int total_screens = 0;
  for (int i = 0; i < interesting.size(); i++) {
    int screens_here =
        interesting[i] / screen_size + (interesting[i] % screen_size > 0);
    int overhead = screens_here * screen_size - interesting[i];
    if (overhead > screens_here) return -1;
    total_screens += screens_here;
  }
  return total_screens;
}
int main() {
  scanf("%d", &tests);
  for (; tests; --tests) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      cnt[i] = 0;
    }
    for (int i = 1; i <= n; i++) {
      int val;
      scanf("%d", &val);
      cnt[val]++;
    }
    int min_nonzero = 1e9;
    int min_id = -1;
    interesting.clear();
    for (int i = 1; i <= n; i++) {
      if (cnt[i] < min_nonzero && cnt[i] > 0) {
        min_nonzero = cnt[i];
        min_id = i;
      }
      if (cnt[i] > 0) interesting.push_back(cnt[i]);
    }
    int ans = 1e9;
    for (int i = 1; i <= cnt[min_id] + 1; i++) {
      int here = solver(i);
      if (here == -1) continue;
      ans = min(ans, here);
    }
    printf("%d\n", ans);
  }
  return 0;
}
