Write a python function to check whether the frequency of each digit is less than or equal to the digit itself.
def validate(n): 
    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
<s>[INST]<<SYS>>Given a task and its code, generate test cases for the code.<</SYS>>Write a python function to check whether the frequency of each digit is less than or equal to the digit itself.
def validate(n): 
    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[/INST]assert validate(1234) == True
assert validate(51241) == False
assert validate(321) == True</s>