




'''simple docstring'''





import os
import pathlib
import tempfile
import uuid

import numpy as np

from ..utils import is_soundfile_availble, is_torch_available, is_vision_available, logging


a		:	Any       =      logging.get_logger(__name__)

if is_vision_available():
  import PIL.Image
  from PIL import Image
  from PIL.Image import Image as ImageType
else:
  a		:	List[Any]       =      object

if is_torch_available():
  import torch

if is_soundfile_availble():
  import soundfile as sf




class      UpperCamelCase       :



  def __init__(			self		,     __lowerCAmelCase ):







      '''simple docstring'''


      _a				:							Tuple							       =      value



  def __str__(			self ):







      '''simple docstring'''


      return self.to_string()



  def     a_							(			self ):







      '''simple docstring'''


      logger.error(
          """This is a raw AgentType of unknown type. Display in notebooks and string conversion will be unreliable""" )
      return self._value



  def     a_							(			self ):







      '''simple docstring'''


      logger.error(
          """This is a raw AgentType of unknown type. Display in notebooks and string conversion will be unreliable""" )
      return str(self._value )






class      UpperCamelCase       (	lowerCamelCase_      ,		lowerCamelCase_       ):



  def     a_							(			self ):







      '''simple docstring'''


      return self._value



  def     a_							(			self ):







      '''simple docstring'''


      return self._value






class      UpperCamelCase       (	lowerCamelCase_      ,		lowerCamelCase_       ):



  def __init__(			self		,     __lowerCAmelCase ):







      '''simple docstring'''


      super().__init__(lowerCamelCase_ )

      if not is_vision_available():
          raise ImportError("""PIL must be installed in order to handle images.""" )

      _a				:							int							       =      None
      _a				:							int							       =      None
      _a				:							List[Any]							       =      None

      if isinstance(lowerCamelCase_		,     lowerCamelCase_ ):
          _a				:							str							       =      value
      elif isinstance(lowerCamelCase_		,     (str, pathlib.Path) ):
          _a				:							int							       =      value
      elif isinstance(lowerCamelCase_		,     torch.Tensor ):
          _a				:							Union[str, Any]							       =      value
      else:
          raise ValueError(f'''Unsupported type for {self.__class__.__name__}: {type(lowerCamelCase_ )}''' )



  def     a_							(			self		,     __lowerCAmelCase=None		,     __lowerCAmelCase=None ):







      '''simple docstring'''


      from IPython.display import Image, display

      display(Image(self.to_string() ) )



  def     a_							(			self ):







      '''simple docstring'''


      if self._raw is not None:
          return self._raw

      if self._path is not None:
          _a				:							Union[str, Any]							       =      Image.open(self._path )
          return self._raw



  def     a_							(			self ):







      '''simple docstring'''


      if self._path is not None:
          return self._path

      if self._raw is not None:
          _a				:							str							       =      tempfile.mkdtemp()
          _a				:							Union[str, Any]							       =      os.path.join(lowerCamelCase_		,     str(uuid.uuida() ) + """.png""" )
          self._raw.save(self._path )

          return self._path

      if self._tensor is not None:
          _a				:							List[str]							       =      self._tensor.cpu().detach().numpy()

          # There is likely simpler than load into image into save
          _a				:							Tuple							       =      Image.fromarray((array * 255).astype(np.uinta ) )

          _a				:							Union[str, Any]							       =      tempfile.mkdtemp()
          _a				:							Union[str, Any]							       =      os.path.join(lowerCamelCase_		,     str(uuid.uuida() ) + """.png""" )

          img.save(self._path )

          return self._path






class      UpperCamelCase       (	lowerCamelCase_       ):



  def __init__(			self		,     __lowerCAmelCase		,     __lowerCAmelCase=1_6000 ):







      '''simple docstring'''


      super().__init__(lowerCamelCase_ )

      if not is_soundfile_availble():
          raise ImportError("""soundfile must be installed in order to handle audio.""" )

      _a				:							Union[str, Any]							       =      None
      _a				:							Tuple							       =      None

      _a				:							int							       =      samplerate

      if isinstance(lowerCamelCase_		,     (str, pathlib.Path) ):
          _a				:							Any							       =      value
      elif isinstance(lowerCamelCase_		,     torch.Tensor ):
          _a				:							int							       =      value
      else:
          raise ValueError(f'''Unsupported audio type: {type(lowerCamelCase_ )}''' )



  def     a_							(			self		,     __lowerCAmelCase=None		,     __lowerCAmelCase=None ):







      '''simple docstring'''


      from IPython.display import Audio, display

      display(Audio(self.to_string()		,     rate=self.samplerate ) )



  def     a_							(			self ):







      '''simple docstring'''


      if self._tensor is not None:
          return self._tensor

      if self._path is not None:
          _a       , _a				:							List[str]							       =      sf.read(self._path )
          _a				:							List[str]							       =      torch.tensor(lowerCamelCase_ )
          return self._tensor



  def     a_							(			self ):







      '''simple docstring'''


      if self._path is not None:
          return self._path

      if self._tensor is not None:
          _a				:							Any							       =      tempfile.mkdtemp()
          _a				:							Union[str, Any]							       =      os.path.join(lowerCamelCase_		,     str(uuid.uuida() ) + """.wav""" )
          sf.write(self._path		,     self._tensor		,     samplerate=self.samplerate )
          return self._path






a		:	Optional[int]       =      {'''text''': AgentText, '''image''': AgentImage, '''audio''': AgentAudio}
a		:	int       =      {str: AgentText}

if is_vision_available():
  a		:	Tuple       =      AgentImage





def UpperCAmelCase    (       *UpperCAmelCase_   ,	**UpperCAmelCase_						):
    _a				:							Union[str, Any]							       =      [(arg.to_raw() if isinstance(lowercase__   ,	lowercase__						) else arg) for arg in args]
    _a				:							str							       =      {k: (v.to_raw() if isinstance(lowercase__   ,	lowercase__						) else v) for k, v in kwargs.items()}
    return args, kwargs





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_=None						):






    if isinstance(lowercase__   ,	lowercase__						):
        _a				:							str							       =      {}
        for i, (k, v) in enumerate(outputs.items()						):
            if output_types is not None:
                # If the class has defined outputs, we can map directly according to the class definition
                if output_types[i] in AGENT_TYPE_MAPPING:
                    _a				:							Tuple							       =      AGENT_TYPE_MAPPING[output_types[i]](lowercase__						)
                else:
                    _a				:							Any							       =      AgentType(lowercase__						)

            else:
                # If the class does not have defined output, then we map according to the type
                for _k, _v in INSTANCE_TYPE_MAPPING.items():
                    if isinstance(lowercase__   ,	_k						):
                        _a				:							Optional[int]							       =      _v(lowercase__						)
                if k not in decoded_outputs:
                    _a				:							Any							       =      AgentType[v]

    elif isinstance(lowercase__   ,	(list, tuple)						):
        _a				:							Union[str, Any]							       =      type(lowercase__						)()
        for i, v in enumerate(lowercase__						):
            if output_types is not None:
                # If the class has defined outputs, we can map directly according to the class definition
                if output_types[i] in AGENT_TYPE_MAPPING:
                    decoded_outputs.append(AGENT_TYPE_MAPPING[output_types[i]](lowercase__						)						)
                else:
                    decoded_outputs.append(AgentType(lowercase__						)						)
            else:
                # If the class does not have defined output, then we map according to the type
                _a				:							List[Any]							       =      False
                for _k, _v in INSTANCE_TYPE_MAPPING.items():
                    if isinstance(lowercase__   ,	_k						):
                        decoded_outputs.append(_v(lowercase__						)						)
                        _a				:							int							       =      True

                if not found:
                    decoded_outputs.append(AgentType(lowercase__						)						)

    else:
        if output_types[0] in AGENT_TYPE_MAPPING:
            # If the class has defined outputs, we can map directly according to the class definition
            _a				:							Tuple							       =      AGENT_TYPE_MAPPING[output_types[0]](lowercase__						)

        else:
            # If the class does not have defined output, then we map according to the type
            for _k, _v in INSTANCE_TYPE_MAPPING.items():
                if isinstance(lowercase__   ,	_k						):
                    return _v(lowercase__						)
            return AgentType(lowercase__						)

    return decoded_outputs






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()))}')

