Max Groups Increasing Length

Given frequencies of values, form the maximum number of groups where each group uses elements of the same value and groups have strictly increasing sizes. Use a greedy approach after sorting frequencies.

Examples
Input: [1,2,1]
Output: 3
Hints

Max Groups Increasing Length

Given frequencies of values, form the maximum number of groups where each group uses elements of the same value and groups have strictly increasing sizes. Use a greedy approach after sorting frequencies.