

"""simple docstring"""



from math import factorial

SCREAMING_SNAKE_CASE_					:	List[Any]		  =						{str(digit): factorial(digit) for digit in range(1_0)}





def  _snake_case     (    UpperCAmelCase_  :					int			):
     if not isinstance(UpperCAmelCase_					,   UpperCAmelCase_			):
          raise TypeError("""Parameter number must be int"""			)

     if number < 0:
          raise ValueError("""Parameter number must be greater than or equal to 0"""			)

     # Converts number in string to iterate on its digits and adds its factorial.
     return sum(DIGIT_FACTORIAL[digit] for digit in str(UpperCAmelCase_			)			)





def  _snake_case     (    UpperCAmelCase_  :					int = 60					,   UpperCAmelCase_  :					int = 100_0000			):

     if not isinstance(UpperCAmelCase_					,   UpperCAmelCase_			) or not isinstance(UpperCAmelCase_					,   UpperCAmelCase_			):
          raise TypeError("""Parameters chain_length and number_limit must be int"""			)

     if chain_length <= 0 or number_limit <= 0:
          raise ValueError(
              """Parameters chain_length and number_limit must be greater than 0"""			)

     # the counter for the chains with the exact desired length
     A__										=  0
     # the cached sizes of the previous chains
     A__										=  {}

     for start_chain_element in range(1					,   UpperCAmelCase_			):
          # The temporary set will contain the elements of the chain
          A__										=  set()
          A__										=  0

          # Stop computing the chain when you find a cached size, a repeating item or the
          # length is greater then the desired one.
          A__										=  start_chain_element
          while (
              chain_element not in chain_sets_lengths
              and chain_element not in chain_set
              and chain_set_length <= chain_length
          ):
               chain_set.add(UpperCAmelCase_			)
               chain_set_length += 1
               A__										=  digit_factorial_sum(UpperCAmelCase_			)

          if chain_element in chain_sets_lengths:
               chain_set_length += chain_sets_lengths[chain_element]

          A__										=  chain_set_length

          # If chain contains the exact amount of elements increase the counter
          if chain_set_length == chain_length:
               chains_counter += 1

     return chains_counter


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 print(f"""{solution()}""")









"""simple docstring"""



def  _snake_case     (    UpperCAmelCase_  :					int			):
     A__										=  1
     for i in range(1					,   num + 1			):
          fact *= i
     return fact





def  _snake_case     (    UpperCAmelCase_  :					int			):
     A__										=  0
     while number > 0:
          A__										=  number % 10
          sum_of_digits += last_digit
          A__										=  number // 10  # Removing the last_digit from the given number
     return sum_of_digits





def  _snake_case     (    UpperCAmelCase_  :					int = 100			):
     A__										=  factorial(UpperCAmelCase_			)
     A__										=  split_and_add(UpperCAmelCase_			)
     return result


if __name__ == "__main__":
 print(solution(int(input('Enter the Number: ').strip())))






