#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  int ji = 0;
  while (t--) {
    int n;
    scanf("%d", &n);
    int arr[n + 1];
    int brr[n + 1];
    memset(arr, 0, sizeof(arr));
    memset(brr, 0, sizeof(brr));
    int ls;
    int size = 0;
    for (int a = 0; a < n; a++) {
      scanf("%d", &ls);
      if (arr[ls] == 0) {
        brr[size] = ls;
        size++;
      }
      arr[ls]++;
    }
    int min = n;
    for (int a = 0; a < size; a++) {
      if (arr[brr[a]] < min) {
        min = arr[brr[a]];
      }
    }
    int num = n;
    int bo = true;
    for (int a = 2; a < min + 2; a++) {
      ls = 0;
      bo = true;
      for (int b = 0; b < size; b++) {
        int tt = arr[brr[b]] / a + 1;
        if (arr[brr[b]] % a == 0) {
          ls = ls + arr[brr[b]] / a;
        } else if (arr[brr[b]] >= (tt * (a - 1)) && arr[brr[b]] <= (tt * a)) {
          ls = ls + tt;
        } else {
          bo = false;
          break;
        }
      }
      if (bo && num > ls) {
        num = ls;
      }
    }
    printf("%d\n", num);
  }
}
