Count frequencies. Sort them in descending order. Track which frequencies are used. For each frequency, if it is already used, reduce it until it is unique or zero. The number of reductions is the number of deletions for that character. Why this greedy choice is optimal: processing frequencies from highest to lowest ensures you never reduce a frequency below a smaller one.
If a frequency is already used, you reduce it to the next available value.