#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, i, j;
    cin >> n;
    vector<int> icons(n);
    for (i = 0; i < n; i++) {
      cin >> icons[i];
    }
    vector<int> num;
    sort(icons.begin(), icons.end());
    int cnt = 1;
    for (i = 1; i < icons.size(); i++) {
      if (icons[i] == icons[i - 1]) {
        cnt++;
      } else {
        num.push_back(cnt);
        cnt = 1;
      }
    }
    num.push_back(cnt);
    int x = num[0] + 1;
    int minNum = 1e9 + 7;
    for (i = 1; i <= x; i++) {
      int sum = 0;
      for (j = 0; j < num.size(); j++) {
        int q = ceil((float)num[j] / i);
        if ((i - 1) * q > num[j]) {
          sum = 1e9 + 7;
          break;
        }
        sum += q;
      }
      if (sum < minNum) minNum = sum;
    }
    cout << minNum << endl;
  }
  return 0;
}
