'''simple docstring'''




import torch
from torch import autograd





class        __magic_name__		(       autograd.Function):







			@staticmethod
			def       SCREAMING_SNAKE_CASE_	(      lowercase_							:    Dict							,     lowercase_							:    torch.tensor							,     lowercase_							:    float							,     lowercase_							:    bool       ):
										lowercase_   :     Dict									=			inputs.numel()
										lowercase_   :     Tuple									=			int(0.0_05 * nb_elems       ) + 1
										if sigmoid:
																	lowercase_   :     Dict									=			(torch.sigmoid(lowercase_       ) > threshold).type(inputs.type()       )
										else:
																	lowercase_   :     List[Any]									=			(inputs > threshold).type(inputs.type()       )
										if mask.sum() < nb_min:
																	# We limit the pruning so that at least 0.5% (half a percent) of the weights are remaining
																	lowercase_   :     Dict									=			inputs.flatten().kthvalue(max(nb_elems - nb_min							,     1       )       ).values
																	lowercase_   :     Dict									=			(inputs > k_threshold).type(inputs.type()       )
										return mask







			@staticmethod
			def       SCREAMING_SNAKE_CASE_	(      lowercase_							:    Optional[Any]							,     lowercase_							:    Optional[Any]       ):
										return gradOutput, None, None





class        __magic_name__		(       autograd.Function):







			@staticmethod
			def       SCREAMING_SNAKE_CASE_	(      lowercase_							:    List[str]							,     lowercase_							:    torch.tensor							,     lowercase_							:    float       ):
										lowercase_   :     Any									=			inputs.clone()
										lowercase_		,		lowercase_   :     Optional[int]									=			inputs.flatten().sort(descending=lowercase_       )
										lowercase_   :     Union[str, Any]									=			int(threshold * inputs.numel()       )

										# flat_out and mask access the same memory.
										lowercase_   :     Tuple									=			mask.flatten()
										lowercase_   :     str									=			0
										lowercase_   :     Union[str, Any]									=			1
										return mask







			@staticmethod
			def       SCREAMING_SNAKE_CASE_	(      lowercase_							:    Tuple							,     lowercase_							:    Union[str, Any]       ):
										return gradOutput, None





class        __magic_name__		(       _UpperCAmelCase):







			@staticmethod
			def       SCREAMING_SNAKE_CASE_	(      lowercase_							:    torch.tensor							,     lowercase_							:    float       ):
										lowercase_   :     Any									=			inputs.clone()
										lowercase_		,		lowercase_   :     Optional[int]									=			inputs.abs().flatten().sort(descending=lowercase_       )
										lowercase_   :     Dict									=			int(threshold * inputs.numel()       )

										# flat_out and mask access the same memory.
										lowercase_   :     Dict									=			mask.flatten()
										lowercase_   :     Tuple									=			0
										lowercase_   :     int									=			1
										return mask







"""simple docstring"""




def __snake_case (      UpperCamelCase = 10**6    )       ->    int:


		"""simple docstring"""





		if n <= 0:
				raise ValueError('''Please enter an integer greater than 0'''    )

		a__   		=     list(range(n + 1    )    )
		for number in range(2						,					n + 1    ):
				if phi[number] == number:
						phi[number] -= 1
						for multiple in range(number * 2						,					n + 1						,					UpperCamelCase    ):
								a__   		=     (phi[multiple] // number) * (number - 1)

		a__   		=     1
		for number in range(1						,					n + 1    ):
				if (answer / phi[answer]) < (number / phi[number]):
						a__   		=     number

		return answer


if __name__ == "__main__":
					print(solution())




