



import copy
import inspect

from transformers.testing_utils import require_torch, torch_device
from transformers.utils.backbone_utils import BackboneType





@require_torch
class 							lowerCAmelCase_		:
		SCREAMING_SNAKE_CASE_       :			Tuple					       =	()
		SCREAMING_SNAKE_CASE_       :			Optional[Any]					       =	True







		def 					a_  (    self  :   Tuple					)       ->		List[Any]:


						'''simple docstring'''







						_UpperCAmelCase						:  Any     					=	self.config_class

						# test default config
						_UpperCAmelCase						:  List[str]     					=	config_class()
						self.assertIsNotNone(UpperCAmelCase_					)
						_UpperCAmelCase						:  Optional[Any]     					=	["""stem"""] + [F'''stage{idx}''' for idx in range(1       ,		len(config.depths					) + 1					)]
						self.assertEqual(config.stage_names       ,		UpperCAmelCase_					)
						self.assertTrue(set(config.out_features					).issubset(set(config.stage_names					)					)					)

						# Test out_features and out_indices are correctly set
						# out_features and out_indices both None
						_UpperCAmelCase						:  Optional[Any]     					=	config_class(out_features=UpperCAmelCase_       ,		out_indices=UpperCAmelCase_					)
						self.assertEqual(config.out_features       ,		[config.stage_names[-1]]					)
						self.assertEqual(config.out_indices       ,		[len(config.stage_names					) - 1]					)

						# out_features and out_indices both set
						_UpperCAmelCase						:  Any     					=	config_class(out_features=['''stem''', '''stage1''']       ,		out_indices=[0, 1]					)
						self.assertEqual(config.out_features       ,		['''stem''', '''stage1''']					)
						self.assertEqual(config.out_indices       ,		[0, 1]					)

						# Only out_features set
						_UpperCAmelCase						:  str     					=	config_class(out_features=['''stage1''', '''stage3''']					)
						self.assertEqual(config.out_features       ,		['''stage1''', '''stage3''']					)
						self.assertEqual(config.out_indices       ,		[1, 3]					)

						# Only out_indices set
						_UpperCAmelCase						:  Any     					=	config_class(out_indices=[0, 2]					)
						self.assertEqual(config.out_features       ,		[config.stage_names[0], config.stage_names[2]]					)
						self.assertEqual(config.out_indices       ,		[0, 2]					)

						# Error raised when out_indices do not correspond to out_features
						with self.assertRaises(UpperCAmelCase_					):
										_UpperCAmelCase						:  str     					=	config_class(out_features=['''stage1''', '''stage2''']       ,		out_indices=[0, 2]					)







		def 					a_  (    self  :   Any					)       ->		int:


						'''simple docstring'''







						_UpperCAmelCase						:  Tuple     					=	self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
										_UpperCAmelCase						:  List[str]     					=	model_class(UpperCAmelCase_					)
										_UpperCAmelCase						:  int     					=	inspect.signature(model.forward					)
										# signature.parameters is an OrderedDict => so arg_names order is deterministic
										_UpperCAmelCase						:  Optional[Any]     					=	[*signature.parameters.keys()]
										_UpperCAmelCase						:  Dict     					=	["""pixel_values"""]
										self.assertListEqual(arg_names[:1]       ,		UpperCAmelCase_					)







		def 					a_  (    self  :   Dict					)       ->		Optional[int]:


						'''simple docstring'''







						_UpperCAmelCase						:  Tuple     					=	self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
										_UpperCAmelCase						:  Dict     					=	model_class(UpperCAmelCase_					)
										self.assertEqual(len(model.channels					)       ,		len(config.out_features					)					)
										_UpperCAmelCase						:  Union[str, Any]     					=	model.num_features
										_UpperCAmelCase						:  Optional[Any]     					=	[config.stage_names.index(UpperCAmelCase_					) for feat in config.out_features]
										_UpperCAmelCase						:  List[str]     					=	[num_features[idx] for idx in out_indices]
										self.assertListEqual(model.channels       ,		UpperCAmelCase_					)

										_UpperCAmelCase						:  List[Any]     					=	copy.deepcopy(UpperCAmelCase_					)
										_UpperCAmelCase						:  List[Any]     					=	None
										_UpperCAmelCase						:  Optional[int]     					=	model_class(UpperCAmelCase_					)
										self.assertEqual(len(model.channels					)       ,		1					)
										self.assertListEqual(model.channels       ,		[num_features[-1]]					)

										_UpperCAmelCase						:  int     					=	copy.deepcopy(UpperCAmelCase_					)
										_UpperCAmelCase						:  Optional[int]     					=	None
										_UpperCAmelCase						:  List[str]     					=	model_class(UpperCAmelCase_					)
										self.assertEqual(len(model.channels					)       ,		1					)
										self.assertListEqual(model.channels       ,		[num_features[-1]]					)







		def 					a_  (    self  :   Optional[int]					)       ->		Dict:


						'''simple docstring'''







						_UpperCAmelCase						:  Optional[Any]     					=	self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
										_UpperCAmelCase						:  Optional[int]     					=	model_class(UpperCAmelCase_					)
										model.to(UpperCAmelCase_					)
										model.eval()
										_UpperCAmelCase						:  Optional[int]     					=	model(**UpperCAmelCase_					)

										self.assertEqual(len(result.feature_maps					)       ,		len(config.out_features					)					)
										self.assertEqual(len(model.channels					)       ,		len(config.out_features					)					)
										self.assertEqual(len(result.feature_maps					)       ,		len(config.out_indices					)					)
										self.assertEqual(len(model.channels					)       ,		len(config.out_indices					)					)

										# Check output of last stage is taken if out_features=None, out_indices=None
										_UpperCAmelCase						:  str     					=	copy.deepcopy(UpperCAmelCase_					)
										_UpperCAmelCase						:  Dict     					=	None
										_UpperCAmelCase						:  Union[str, Any]     					=	model_class(UpperCAmelCase_					)
										model.to(UpperCAmelCase_					)
										model.eval()
										_UpperCAmelCase						:  int     					=	model(**UpperCAmelCase_					)

										self.assertEqual(len(result.feature_maps					)       ,		1					)
										self.assertEqual(len(model.channels					)       ,		1					)

										_UpperCAmelCase						:  List[str]     					=	copy.deepcopy(UpperCAmelCase_					)
										_UpperCAmelCase						:  Any     					=	None
										_UpperCAmelCase						:  int     					=	model_class(UpperCAmelCase_					)
										model.to(UpperCAmelCase_					)
										model.eval()
										_UpperCAmelCase						:  Optional[int]     					=	model(**UpperCAmelCase_					)

										self.assertEqual(len(result.feature_maps					)       ,		1					)
										self.assertEqual(len(model.channels					)       ,		1					)

										# Check backbone can be initialized with fresh weights
										_UpperCAmelCase						:  int     					=	copy.deepcopy(UpperCAmelCase_					)
										_UpperCAmelCase						:  int     					=	False
										_UpperCAmelCase						:  int     					=	model_class(UpperCAmelCase_					)
										model.to(UpperCAmelCase_					)
										model.eval()
										_UpperCAmelCase						:  Optional[int]     					=	model(**UpperCAmelCase_					)







		def 					a_  (    self  :   List[Any]					)       ->		Any:


						'''simple docstring'''







						_UpperCAmelCase						:  Optional[int]     					=	self.model_tester.prepare_config_and_inputs_for_common()

						for backbone_class in self.all_model_classes:
										_UpperCAmelCase						:  List[Any]     					=	backbone_class(UpperCAmelCase_					)

										self.assertTrue(hasattr(UpperCAmelCase_       ,		'''backbone_type'''					)					)
										self.assertTrue(hasattr(UpperCAmelCase_       ,		'''stage_names'''					)					)
										self.assertTrue(hasattr(UpperCAmelCase_       ,		'''num_features'''					)					)
										self.assertTrue(hasattr(UpperCAmelCase_       ,		'''out_indices'''					)					)
										self.assertTrue(hasattr(UpperCAmelCase_       ,		'''out_features'''					)					)
										self.assertTrue(hasattr(UpperCAmelCase_       ,		'''out_feature_channels'''					)					)
										self.assertTrue(hasattr(UpperCAmelCase_       ,		'''channels'''					)					)

										self.assertIsInstance(backbone.backbone_type       ,		UpperCAmelCase_					)
										# Verify num_features has been initialized in the backbone init
										self.assertIsNotNone(backbone.num_features					)
										self.assertTrue(len(backbone.channels					) == len(backbone.out_indices					)					)
										self.assertTrue(len(backbone.stage_names					) == len(backbone.num_features					)					)
										self.assertTrue(len(backbone.channels					) <= len(backbone.num_features					)					)
										self.assertTrue(len(backbone.out_feature_channels					) == len(backbone.stage_names					)					)







		def 					a_  (    self  :   Union[str, Any]					)       ->		int:


						'''simple docstring'''







						_UpperCAmelCase						:  int     					=	self.model_tester.prepare_config_and_inputs_for_common()
						_UpperCAmelCase						:  int     					=	inputs_dict["""pixel_values"""].shape[0]

						for backbone_class in self.all_model_classes:
										_UpperCAmelCase						:  List[str]     					=	backbone_class(UpperCAmelCase_					)
										backbone.to(UpperCAmelCase_					)
										backbone.eval()

										_UpperCAmelCase						:  str     					=	backbone(**UpperCAmelCase_					)

										# Test default outputs and verify feature maps
										self.assertIsInstance(outputs.feature_maps       ,		UpperCAmelCase_					)
										self.assertTrue(len(outputs.feature_maps					) == len(backbone.channels					)					)
										for feature_map, n_channels in zip(outputs.feature_maps       ,		backbone.channels					):
														self.assertTrue(feature_map.shape[:2]       ,		(batch_size, n_channels)					)
										self.assertIsNone(outputs.hidden_states					)
										self.assertIsNone(outputs.attentions					)

										# Test output_hidden_states=True
										_UpperCAmelCase						:  List[Any]     					=	backbone(**UpperCAmelCase_       ,		output_hidden_states=UpperCAmelCase_					)
										self.assertIsNotNone(outputs.hidden_states					)
										self.assertTrue(len(outputs.hidden_states					)       ,		len(backbone.stage_names					)					)
										for hidden_state, n_channels in zip(outputs.hidden_states       ,		backbone.channels					):
														self.assertTrue(hidden_state.shape[:2]       ,		(batch_size, n_channels)					)

										# Test output_attentions=True
										if self.has_attentions:
														_UpperCAmelCase						:  Any     					=	backbone(**UpperCAmelCase_       ,		output_attentions=UpperCAmelCase_					)
														self.assertIsNotNone(outputs.attentions					)





"""simple docstring"""







from math import floor, sqrt


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase      ):
		_lowercase				: Optional[int]     =   0.0
		_lowercase				: Dict     =   1.0
		_lowercase				: Optional[int]     =   int(sqrt(__UpperCAmelCase      )      )
		_lowercase				: Optional[Any]     =   root
		_lowercase				: Dict     =   0
		while integer_part != 2 * root:
				_lowercase				: str     =   denominator * integer_part - numerator
				_lowercase				: Optional[int]     =   (n - numerator**2) / denominator
				_lowercase				: List[str]     =   int((root + numerator) / denominator      )
				period += 1
		return period


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase = 10000      ):
		_lowercase				: List[str]     =   0
		for i in range(2   ,				n + 1      ):
				_lowercase				: Dict     =   sqrt(__UpperCAmelCase      )
				if sr - floor(__UpperCAmelCase      ) != 0 and continuous_fraction_period(__UpperCAmelCase      ) % 2 == 1:
						count_odd_periods += 1
		return count_odd_periods


if __name__ == "__main__":
		print(F'{solution(int(input().strip()))}')



