
    Write a function that validates a ride-sharing vehicle's identifier number by ensuring each digit in the ID appears no more times than its own value to maintain balanced service distribution. For instance, in a vehicle ID 1223, having two 2's is valid since 2 is greater than or equal to its frequency (2), but three 2's would be invalid since 2 is less than that frequency (3).
    

    
def validate(n):
    """
    Write a function that validates a ride-sharing vehicle's identifier number by ensuring each digit in the ID appears no more times than its own value to maintain balanced service distribution. For instance, in a vehicle ID 1223, having two 2's is valid since 2 is greater than or equal to its frequency (2), but three 2's would be invalid since 2 is less than that frequency (3).
    

    """
def validate(n):
    """
    Write a function that validates a ride-sharing vehicle's identifier number by ensuring each digit in the ID appears no more times than its own value to maintain balanced service distribution. For instance, in a vehicle ID 1223, having two 2's is valid since 2 is greater than or equal to its frequency (2), but three 2's would be invalid since 2 is less than that frequency (3).
    

    """
    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