def validate(n):
    s = str(abs(n))
    for digit in '0123456789':
        if s.count(digit) > int(digit):
            return False
    return True