


def 				__lowerCamelCase						( UpperCAmelCase_						:		Any ,  UpperCAmelCase_						:		Any						):




      """simple docstring"""





      a						:Union[str, Any] 							=       [1]
      for i in range(2 ,  UpperCAmelCase_						):
            factorials.append(factorials[-1] * i						)
      assert 0 <= k < factorials[-1] * n, "k out of bounds"

      a						:Optional[Any] 							=       []
      a						:List[Any] 							=       list(range(UpperCAmelCase_						)						)

      # Find permutation
      while factorials:
            a						:List[Any] 							=       factorials.pop()
            a							,				a						:List[str] 							=       divmod(UpperCAmelCase_ ,  UpperCAmelCase_						)
            permutation.append(elements[number]						)
            elements.remove(elements[number]						)
      permutation.append(elements[0]						)

      return permutation


if __name__ == "__main__":
     import doctest

     doctest.testmod()









def 				__lowerCamelCase						( UpperCAmelCase_						:		int = 1000						):




      """simple docstring"""





      a							,				a						:int 							=       1, 1
      a						:Any 							=       2
      while True:
            a						:Optional[int] 							=       0
            a						:str 							=       fa + fa
            a							,				a						:List[Any] 							=       fa, f
            index += 1
            for _ in str(UpperCAmelCase_						):
                  i += 1
            if i == n:
                  break
      return index


if __name__ == "__main__":
     print(solution(int(str(input()).strip())))





