Count of N | Function to return the factorial of n ; Function to return the count of n - digit numbers with all distinct digits ; Driver code
def factorial ( n ) : NEW_LINE INDENT if ( n == 0 ) : NEW_LINE INDENT return 1 ; NEW_LINE DEDENT return n * factorial ( n - 1 ) ; NEW_LINE DEDENT def countNum ( n ) : NEW_LINE INDENT if ( n > 10 ) : NEW_LINE INDENT return 0 ; NEW_LINE DEDENT return ( 9 * factorial ( 9 ) // factorial ( 10 - n ) ) ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 3 ; NEW_LINE print ( countNum ( n ) ) ; NEW_LINE DEDENT