#include <bits/stdc++.h>
using namespace std;
const int SZ = 2000003;
int t, n, a, m, b[SZ], c[SZ];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    m = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a);
      if (c[a] == 0) {
        b[m++] = a;
      }
      c[a]++;
    }
    for (int i = 0; i < m; i++) {
      int x = b[i];
      b[i] = c[x];
      c[x] = 0;
    }
    sort(b, b + m);
    int sz = 1;
    for (int i = b[0] + 1; i > 0; i--) {
      int x = 0;
      for (int j = 0; j < m; j++) {
        int r = b[j] % i;
        int y = b[j] / i;
        if (r > 0 && y < (i - 1 - r)) {
          break;
        }
        x++;
      }
      if (x == m) {
        sz = i;
        break;
      }
    }
    int ans = 0;
    for (int i = 0; i < m; i++) {
      ans += ceil((double)b[i] / sz);
    }
    printf("%d\n", ans);
  }
  return 0;
}
