def input_valid_number(max: int) -> int:
    """
    input a valid number from 1 through max
    anything else is rejected and asked for again
    """
    while True:
        try:
            nbr = int(input(f"Enter the number of counted domains : (1-{max}): "))
        except ValueError:
            print(f"Sorry, i need an integer between 1 and {max}")
            continue

        if nbr < 1:
            print("Sorry, your response must not less than 1.")
            continue
        if nbr > max:
            print(f"Sorry, your response must not be more than {max}")
            continue
        else:
            # valid number entered
            break
    return nbr