
    Write a function that takes a user's mutual connection identifier and validates if the frequency of each connection type (represented by digits) doesn't exceed its own value, ensuring balanced friend recommendations. For example, if a user has a mutual connection identifier of 1224, the digit 1 should not appear more than 1 time, and digit 2 should not appear more than 2 times.
    

    
def validate(n):
    """
    Write a function that takes a user's mutual connection identifier and validates if the frequency of each connection type (represented by digits) doesn't exceed its own value, ensuring balanced friend recommendations. For example, if a user has a mutual connection identifier of 1224, the digit 1 should not appear more than 1 time, and digit 2 should not appear more than 2 times.
    

    """
def validate(n):
    """
    Write a function that takes a user's mutual connection identifier and validates if the frequency of each connection type (represented by digits) doesn't exceed its own value, ensuring balanced friend recommendations. For example, if a user has a mutual connection identifier of 1224, the digit 1 should not appear more than 1 time, and digit 2 should not appear more than 2 times.
    

    """
    for i in range(10):
        temp = n
        count = 0
        while temp:
            if temp % 10 == i:
                count += 1
            if count > i:
                return False
            temp //= 10
    return True