


from typing import Any, Callable, Dict, List, Optional, Union

import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    DiffusionPipeline,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionImgaImgPipeline,
    StableDiffusionInpaintPipelineLegacy,
    StableDiffusionPipeline,
    UNetaDConditionModel,
)
from diffusers.configuration_utils import FrozenDict
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
from diffusers.utils import deprecate, logging


__SCREAMING_SNAKE_CASE	:							Tuple           =  logging.get_logger(__name__)  # pylint: disable=invalid-name


class        __lowerCamelCase      (				lowerCamelCase_ ):


				"""simple docstring"""







				a_:		Union[str, Any]					      =	["""safety_checker""", """feature_extractor"""]






				def __init__(				self     :    Dict	,							lowerCamelCase_     :    AutoencoderKL	,							lowerCamelCase_     :    CLIPTextModel	,							lowerCamelCase_     :    CLIPTokenizer	,							lowerCamelCase_     :    UNetaDConditionModel	,							lowerCamelCase_     :    Union[DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler]	,							lowerCamelCase_     :    StableDiffusionSafetyChecker	,							lowerCamelCase_     :    CLIPImageProcessor	,							lowerCamelCase_     :    bool = True	,							):
								super().__init__()
								if hasattr(scheduler.config	,							"""steps_offset"""					) and scheduler.config.steps_offset != 1:
												_lowerCAmelCase  						=(
												    F"The configuration file of this scheduler: {scheduler} is outdated. `steps_offset`"
												    F" should be set to 1 instead of {scheduler.config.steps_offset}. Please make sure "
												    """to update the config accordingly as leaving `steps_offset` might led to incorrect results"""
												    """ in future versions. If you have downloaded this checkpoint from the Hugging Face Hub,"""
												    """ it would be very nice if you could open a Pull request for the `scheduler/scheduler_config.json`"""
												    """ file"""
												)
												deprecate("""steps_offset!=1"""	,							"""1.0.0"""	,							lowerCamelCase_	,							standard_warn=lowerCamelCase_					)
												_lowerCAmelCase  						=dict(scheduler.config					)
												_lowerCAmelCase  						=1
												_lowerCAmelCase  						=FrozenDict(lowerCamelCase_					)

								self.register_modules(
								    vae=lowerCamelCase_	,							text_encoder=lowerCamelCase_	,							tokenizer=lowerCamelCase_	,							unet=lowerCamelCase_	,							scheduler=lowerCamelCase_	,							safety_checker=lowerCamelCase_	,							feature_extractor=lowerCamelCase_	,							)
								self.register_to_config(requires_safety_checker=lowerCamelCase_					)






				@property
				def        lowerCAmelCase__			(				self     :    int					):
								return {k: getattr(self	,							lowerCamelCase_					) for k in self.config.keys() if not k.startswith("""_"""					)}






				def        lowerCAmelCase__			(				self     :    int	,							lowerCamelCase_     :    Optional[Union[str, int]] = "auto"					):
								if slice_size == "auto":
												# half the attention head size is usually a good trade-off between
												# speed and memory
												_lowerCAmelCase  						=self.unet.config.attention_head_dim // 2
								self.unet.set_attention_slice(lowerCamelCase_					)






				def        lowerCAmelCase__			(				self     :    Union[str, Any]					):
								self.enable_attention_slicing(lowerCamelCase_					)






				@torch.no_grad()
				def        lowerCAmelCase__			(				self     :    List[str]	,							lowerCamelCase_     :    Union[str, List[str]]	,							lowerCamelCase_     :    Union[torch.FloatTensor, PIL.Image.Image]	,							lowerCamelCase_     :    Union[torch.FloatTensor, PIL.Image.Image]	,							lowerCamelCase_     :    float = 0.8	,							lowerCamelCase_     :    Optional[int] = 50	,							lowerCamelCase_     :    Optional[float] = 7.5	,							lowerCamelCase_     :    Optional[Union[str, List[str]]] = None	,							lowerCamelCase_     :    Optional[int] = 1	,							lowerCamelCase_     :    Optional[float] = 0.0	,							lowerCamelCase_     :    Optional[torch.Generator] = None	,							lowerCamelCase_     :    Optional[str] = "pil"	,							lowerCamelCase_     :    bool = True	,							lowerCamelCase_     :    Optional[Callable[[int, int, torch.FloatTensor], None]] = None	,							lowerCamelCase_     :    int = 1	,							):
								# For more information on how this function works, please see: https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionImg2ImgPipeline
								return StableDiffusionInpaintPipelineLegacy(**self.components					)(
								    prompt=lowerCamelCase_	,							image=lowerCamelCase_	,							mask_image=lowerCamelCase_	,							strength=lowerCamelCase_	,							num_inference_steps=lowerCamelCase_	,							guidance_scale=lowerCamelCase_	,							negative_prompt=lowerCamelCase_	,							num_images_per_prompt=lowerCamelCase_	,							eta=lowerCamelCase_	,							generator=lowerCamelCase_	,							output_type=lowerCamelCase_	,							return_dict=lowerCamelCase_	,							callback=lowerCamelCase_	,							)






				@torch.no_grad()
				def        lowerCAmelCase__			(				self     :    List[str]	,							lowerCamelCase_     :    Union[str, List[str]]	,							lowerCamelCase_     :    Union[torch.FloatTensor, PIL.Image.Image]	,							lowerCamelCase_     :    float = 0.8	,							lowerCamelCase_     :    Optional[int] = 50	,							lowerCamelCase_     :    Optional[float] = 7.5	,							lowerCamelCase_     :    Optional[Union[str, List[str]]] = None	,							lowerCamelCase_     :    Optional[int] = 1	,							lowerCamelCase_     :    Optional[float] = 0.0	,							lowerCamelCase_     :    Optional[torch.Generator] = None	,							lowerCamelCase_     :    Optional[str] = "pil"	,							lowerCamelCase_     :    bool = True	,							lowerCamelCase_     :    Optional[Callable[[int, int, torch.FloatTensor], None]] = None	,							lowerCamelCase_     :    int = 1	,							**lowerCamelCase_     :    str	,							):
								# For more information on how this function works, please see: https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionImg2ImgPipeline
								return StableDiffusionImgaImgPipeline(**self.components					)(
								    prompt=lowerCamelCase_	,							image=lowerCamelCase_	,							strength=lowerCamelCase_	,							num_inference_steps=lowerCamelCase_	,							guidance_scale=lowerCamelCase_	,							negative_prompt=lowerCamelCase_	,							num_images_per_prompt=lowerCamelCase_	,							eta=lowerCamelCase_	,							generator=lowerCamelCase_	,							output_type=lowerCamelCase_	,							return_dict=lowerCamelCase_	,							callback=lowerCamelCase_	,							callback_steps=lowerCamelCase_	,							)






				@torch.no_grad()
				def        lowerCAmelCase__			(				self     :    List[str]	,							lowerCamelCase_     :    Union[str, List[str]]	,							lowerCamelCase_     :    int = 512	,							lowerCamelCase_     :    int = 512	,							lowerCamelCase_     :    int = 50	,							lowerCamelCase_     :    float = 7.5	,							lowerCamelCase_     :    Optional[Union[str, List[str]]] = None	,							lowerCamelCase_     :    Optional[int] = 1	,							lowerCamelCase_     :    float = 0.0	,							lowerCamelCase_     :    Optional[torch.Generator] = None	,							lowerCamelCase_     :    Optional[torch.FloatTensor] = None	,							lowerCamelCase_     :    Optional[str] = "pil"	,							lowerCamelCase_     :    bool = True	,							lowerCamelCase_     :    Optional[Callable[[int, int, torch.FloatTensor], None]] = None	,							lowerCamelCase_     :    int = 1	,							):
								# For more information on how this function https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionPipeline
								return StableDiffusionPipeline(**self.components					)(
								    prompt=lowerCamelCase_	,							height=lowerCamelCase_	,							width=lowerCamelCase_	,							num_inference_steps=lowerCamelCase_	,							guidance_scale=lowerCamelCase_	,							negative_prompt=lowerCamelCase_	,							num_images_per_prompt=lowerCamelCase_	,							eta=lowerCamelCase_	,							generator=lowerCamelCase_	,							latents=lowerCamelCase_	,							output_type=lowerCamelCase_	,							return_dict=lowerCamelCase_	,							callback=lowerCamelCase_	,							callback_steps=lowerCamelCase_	,							)





from math import floor, sqrt

def 		snake_case_   (				lowercase__     :    int     ):






				'''simple docstring'''






				_lowerCAmelCase  						=0.0
				_lowerCAmelCase  						=1.0
				_lowerCAmelCase  						=int(sqrt(lowercase__     )     )
				_lowerCAmelCase  						=root
				_lowerCAmelCase  						=0
				while integer_part != 2 * root:
								_lowerCAmelCase  						=denominator * integer_part - numerator
								_lowerCAmelCase  						=(n - numerator**2) / denominator
								_lowerCAmelCase  						=int((root + numerator) / denominator     )
								period += 1
				return period

def 		snake_case_   (				lowercase__     :    int = 1_00_00     ):






				'''simple docstring'''






				_lowerCAmelCase  						=0
				for i in range(2       ,     n + 1     ):
								_lowerCAmelCase  						=sqrt(lowercase__     )
								if sr - floor(lowercase__     ) != 0 and continuous_fraction_period(lowercase__     ) % 2 == 1:
												count_odd_periods += 1
				return count_odd_periods


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

