class Solution(object):
    def minDeletions(self, s):
        """
        :type s: str
        :rtype: int
        """

        freq_map = {}
        count = 0
        unique_val = []
        # hash freq map
        for char in s:
            if char not in freq_map:
                freq_map[char] = 0
            freq_map[char] += 1
        
        #
        for char in freq_map:
            while freq_map[char] > 0 and freq_map[char] in unique_val:
                count += 1
                freq_map[char] -= 1
            if freq_map[char] not in unique_val:
                unique_val.append(freq_map[char])
        return count
                
            
        