

'''simple docstring'''



from math import floor, sqrt

def   lowerCamelCase__       (      a__)		->    int:



    """simple docstring"""







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

def   lowerCamelCase__       (      a__ = 1_0_0_0_0)		->    int:



    """simple docstring"""







    _snake_case : Dict												=		0
    for i in range(2			,      n + 1):
        _snake_case : Optional[int]												=		sqrt(a__)
        if sr - floor(a__) != 0 and continuous_fraction_period(a__) % 2 == 1:
            count_odd_periods += 1
    return count_odd_periods


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






'''simple docstring'''



import shutil
import tempfile
import unittest

import numpy as np
import pytest

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available


if is_torch_available():
   from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_11
else:
   SCREAMING_SNAKE_CASE_    =   False

if is_vision_available():
   from PIL import Image

   from transformers import (
       AutoProcessor,
       PixaStructImageProcessor,
       PixaStructProcessor,
       PreTrainedTokenizerFast,
       TaTokenizer,
   )

@unittest.skipIf(
    not is_torch_greater_or_equal_than_1_11      ,reason='''`Pix2StructImageProcessor` requires `torch>=1.11.0`.'''      ,)
@require_vision
@require_torch
class 			SCREAMING_SNAKE_CASE					(							unittest.TestCase					):






      '''simple docstring'''






      def 	__UpperCAmelCase			(					self :		Union[str, Any]   ):



          """simple docstring"""





          _snake_case : int												=		tempfile.mkdtemp()

          _snake_case : Optional[int]												=		PixaStructImageProcessor()
          _snake_case : Dict												=		TaTokenizer.from_pretrained('t5-small'   )

          _snake_case : Optional[Any]												=		PixaStructProcessor(snake_case     ,					snake_case   )

          processor.save_pretrained(self.tmpdirname   )




      def 	__UpperCAmelCase			(					self :		Optional[Any]     ,					**snake_case :		Any   ):



          """simple docstring"""





          return AutoProcessor.from_pretrained(self.tmpdirname     ,					**snake_case   ).tokenizer




      def 	__UpperCAmelCase			(					self :		int     ,					**snake_case :		Optional[int]   ):



          """simple docstring"""





          return AutoProcessor.from_pretrained(self.tmpdirname     ,					**snake_case   ).image_processor




      def 	__UpperCAmelCase			(					self :		str   ):



          """simple docstring"""





          shutil.rmtree(self.tmpdirname   )




      def 	__UpperCAmelCase			(					self :		Tuple   ):



          """simple docstring"""





          _snake_case : List[Any]												=		[np.random.randint(255     ,					size=(3, 30, 400)     ,					dtype=np.uinta   )]

          _snake_case : List[str]												=		[Image.fromarray(np.moveaxis(snake_case     ,					0     ,					-1   )   ) for x in image_inputs]

          return image_inputs




      def 	__UpperCAmelCase			(					self :		Any   ):



          """simple docstring"""





          _snake_case : Optional[Any]												=		PixaStructProcessor(tokenizer=self.get_tokenizer()     ,					image_processor=self.get_image_processor()   )
          processor.save_pretrained(self.tmpdirname   )

          _snake_case : Tuple												=		self.get_tokenizer(bos_token='(BOS)'     ,					eos_token='(EOS)'   )
          _snake_case : Dict												=		self.get_image_processor(do_normalize=snake_case     ,					padding_value=1.0   )

          _snake_case : int												=		PixaStructProcessor.from_pretrained(
              self.tmpdirname     ,					bos_token='(BOS)'     ,					eos_token='(EOS)'     ,					do_normalize=snake_case     ,					padding_value=1.0   )

          self.assertEqual(processor.tokenizer.get_vocab()     ,					tokenizer_add_kwargs.get_vocab()   )
          self.assertIsInstance(processor.tokenizer     ,					snake_case   )

          self.assertEqual(processor.image_processor.to_json_string()     ,					image_processor_add_kwargs.to_json_string()   )
          self.assertIsInstance(processor.image_processor     ,					snake_case   )




      def 	__UpperCAmelCase			(					self :		Any   ):



          """simple docstring"""





          _snake_case : Tuple												=		self.get_image_processor()
          _snake_case : Optional[Any]												=		self.get_tokenizer()

          _snake_case : Optional[int]												=		PixaStructProcessor(tokenizer=snake_case     ,					image_processor=snake_case   )

          _snake_case : List[str]												=		self.prepare_image_inputs()

          _snake_case : Optional[Any]												=		image_processor(snake_case     ,					return_tensors='np'   )
          _snake_case : Tuple												=		processor(images=snake_case     ,					return_tensors='np'   )

          for key in input_feat_extract.keys():
              self.assertAlmostEqual(input_feat_extract[key].sum()     ,					input_processor[key].sum()     ,					delta=1e-2   )




      def 	__UpperCAmelCase			(					self :		Dict   ):



          """simple docstring"""





          _snake_case : Optional[Any]												=		self.get_image_processor()
          _snake_case : Union[str, Any]												=		self.get_tokenizer()

          _snake_case : str												=		PixaStructProcessor(tokenizer=snake_case     ,					image_processor=snake_case   )

          _snake_case : List[str]												=		'lower newer'

          _snake_case : Dict												=		processor(text=snake_case   )

          _snake_case : Any												=		tokenizer(snake_case     ,					return_token_type_ids=snake_case     ,					add_special_tokens=snake_case   )

          for key in encoded_tok.keys():
              self.assertListEqual(encoded_tok[key]     ,					encoded_processor[key]   )




      def 	__UpperCAmelCase			(					self :		Union[str, Any]   ):



          """simple docstring"""





          _snake_case : Tuple												=		self.get_image_processor()
          _snake_case : List[str]												=		self.get_tokenizer()

          _snake_case : int												=		PixaStructProcessor(tokenizer=snake_case     ,					image_processor=snake_case   )

          _snake_case : Optional[Any]												=		'lower newer'
          _snake_case : Any												=		self.prepare_image_inputs()

          _snake_case : Any												=		processor(text=snake_case     ,					images=snake_case   )

          self.assertListEqual(
              list(inputs.keys()   )     ,					['flattened_patches', 'attention_mask', 'decoder_attention_mask', 'decoder_input_ids']   )

          # test if it raises when no input is passed
          with pytest.raises(snake_case   ):
              processor()




      def 	__UpperCAmelCase			(					self :		Any   ):



          """simple docstring"""





          _snake_case : int												=		self.get_image_processor()
          _snake_case : List[str]												=		self.get_tokenizer()

          _snake_case : Optional[Any]												=		PixaStructProcessor(tokenizer=snake_case     ,					image_processor=snake_case   )

          _snake_case : Optional[Any]												=		'lower newer'
          _snake_case : str												=		self.prepare_image_inputs()

          _snake_case : Optional[Any]												=		processor(text=snake_case     ,					images=snake_case   )

          _snake_case : Tuple												=		[512, 1024, 2048, 4096]
          _snake_case : str												=		[770, 770, 770, 770]
          # with text
          for i, max_patch in enumerate(snake_case   ):
              _snake_case : List[Any]												=		processor(text=snake_case     ,					images=snake_case     ,					max_patches=snake_case   )
              self.assertEqual(inputs['flattened_patches'][0].shape[0]     ,					snake_case   )
              self.assertEqual(inputs['flattened_patches'][0].shape[1]     ,					expected_hidden_size[i]   )

          # without text input
          for i, max_patch in enumerate(snake_case   ):
              _snake_case : Union[str, Any]												=		processor(images=snake_case     ,					max_patches=snake_case   )
              self.assertEqual(inputs['flattened_patches'][0].shape[0]     ,					snake_case   )
              self.assertEqual(inputs['flattened_patches'][0].shape[1]     ,					expected_hidden_size[i]   )




      def 	__UpperCAmelCase			(					self :		int   ):



          """simple docstring"""





          _snake_case : Union[str, Any]												=		self.get_image_processor()
          _snake_case : List[Any]												=		self.get_tokenizer()

          _snake_case : List[Any]												=		PixaStructProcessor(tokenizer=snake_case     ,					image_processor=snake_case   )

          _snake_case : List[Any]												=		[[1, 4, 5, 8, 1, 0, 8], [3, 4, 3, 1, 1, 8, 9]]

          _snake_case : Dict												=		processor.batch_decode(snake_case   )
          _snake_case : List[Any]												=		tokenizer.batch_decode(snake_case   )

          self.assertListEqual(snake_case     ,					snake_case   )




      def 	__UpperCAmelCase			(					self :		Dict   ):



          """simple docstring"""





          _snake_case : str												=		self.get_image_processor()
          _snake_case : Optional[int]												=		self.get_tokenizer()

          _snake_case : List[str]												=		PixaStructProcessor(tokenizer=snake_case     ,					image_processor=snake_case   )

          _snake_case : Tuple												=		'lower newer'
          _snake_case : List[Any]												=		self.prepare_image_inputs()

          _snake_case : Tuple												=		processor(text=snake_case     ,					images=snake_case   )

          # For now the processor supports only ["flattened_patches", "input_ids", "attention_mask", "decoder_attention_mask"]
          self.assertListEqual(
              list(inputs.keys()   )     ,					['flattened_patches', 'attention_mask', 'decoder_attention_mask', 'decoder_input_ids']   )

          _snake_case : str												=		processor(text=snake_case   )

          # For now the processor supports only ["flattened_patches", "input_ids", "attention_mask", "decoder_attention_mask"]
          self.assertListEqual(list(inputs.keys()   )     ,					['input_ids', 'attention_mask']   )



