#include <vector>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <cmath>
#include <climits>
using vecI = std::vector<int>;
using hmII = std::unordered_map<int, int>;
using std::ceil;
class Solution {
public:
int minimumK(vecI& nums) {
if (nums.size() == 1) return nums[0];
int minE = *std::min_element(std::begin(nums), std::end(nums));
int cf = minE;
hmII hm;
for (const int& n : nums) hm[n]++;
int minnops = INT_MAX;
while (cf > 1) {
int nOps = 0;
for (auto& [k, v]: hm) {
nOps += ceil(k / cf) * v;
}
if (nOps < minnops) minnops = nOps;
}
return minnops;
}
};