Count the number of removals for each frequency and update the minimum removals required
if ( v [ i ] != v [ i - 1 ] ) : NEW_LINE INDENT safe = v [ i ] * ( size - i ) NEW_LINE ans = min ( ans , N - safe ) NEW_LINE DEDENT