
import sys
from collections.abc import Mapping

import numpy as np
import pyarrow as pa

from .. import config
from ..utils.py_utils import map_nested
from .formatting import TensorFormatter


class 						__magic_name__				(  TensorFormatter[Mapping, np.ndarray, Mapping]      ):





		def __init__(							self      :		int  ,					lowerCamelCase__      :		Dict=None  ,					**lowerCamelCase__      :		Optional[int]			):
							super().__init__(features=lowerCamelCase__			)
							lowerCAmelCase						:   Optional[Any]							=       np_array_kwargs





		def  _A							(							self      :		Optional[int]  ,					lowerCamelCase__      :		int			):
							if isinstance(lowerCamelCase__  ,					lowerCamelCase__			):
												if column and all(
												    isinstance(lowerCamelCase__  ,					np.ndarray			) and x.shape == column[0].shape and x.dtype == column[0].dtype for x in column			):
																	return np.stack(lowerCamelCase__			)
												else:
																	# don't use np.array(column, dtype=object)
																	# since it fails in certain cases
																	# see https://stackoverflow.com/q/51005699
																	lowerCAmelCase						:   Union[str, Any]							=       np.empty(len(lowerCamelCase__			)  ,					dtype=lowerCamelCase__			)
																	lowerCAmelCase						:   List[str]							=       column
																	return out
							return column





		def  _A							(							self      :		int  ,					lowerCamelCase__      :		Optional[Any]			):
							if isinstance(lowerCamelCase__  ,					(str, bytes, type(lowerCamelCase__			))			):
												return value
							elif isinstance(lowerCamelCase__  ,					(np.character, np.ndarray)			) and np.issubdtype(value.dtype  ,					np.character			):
												return value
							elif isinstance(lowerCamelCase__  ,					np.number			):
												return value

							lowerCAmelCase						:   Dict							=       {}

							if isinstance(lowerCamelCase__  ,					np.ndarray			) and np.issubdtype(value.dtype  ,					np.integer			):
												lowerCAmelCase						:   List[Any]							=       {'''dtype''': np.intaa}
							elif isinstance(lowerCamelCase__  ,					np.ndarray			) and np.issubdtype(value.dtype  ,					np.floating			):
												lowerCAmelCase						:   Dict							=       {'''dtype''': np.floataa}
							elif config.PIL_AVAILABLE and "PIL" in sys.modules:
												import PIL.Image

												if isinstance(lowerCamelCase__  ,					PIL.Image.Image			):
																	return np.asarray(lowerCamelCase__  ,					**self.np_array_kwargs			)

							return np.asarray(lowerCamelCase__  ,					**{**default_dtype, **self.np_array_kwargs}			)





		def  _A							(							self      :		Any  ,					lowerCamelCase__      :		Tuple			):
							# support for torch, tf, jax etc.
							if config.TORCH_AVAILABLE and "torch" in sys.modules:
												import torch

												if isinstance(lowerCamelCase__  ,					torch.Tensor			):
																	return self._tensorize(data_struct.detach().cpu().numpy()[()]			)
							if hasattr(lowerCamelCase__  ,					'''__array__'''			) and not isinstance(lowerCamelCase__  ,					(np.ndarray, np.character, np.number)			):
												lowerCAmelCase						:   Tuple							=       data_struct.__array__()
							# support for nested types like struct of list of struct
							if isinstance(lowerCamelCase__  ,					np.ndarray			):
												if data_struct.dtype == object:
																	return self._consolidate([self.recursive_tensorize(lowerCamelCase__			) for substruct in data_struct]			)
							if isinstance(lowerCamelCase__  ,					(list, tuple)			):
												return self._consolidate([self.recursive_tensorize(lowerCamelCase__			) for substruct in data_struct]			)
							return self._tensorize(lowerCamelCase__			)





		def  _A							(							self      :		Dict  ,					lowerCamelCase__      :		dict			):
							return map_nested(self._recursive_tensorize  ,					lowerCamelCase__  ,					map_list=lowerCamelCase__			)





		def  _A							(							self      :		int  ,					lowerCamelCase__      :		pa.Table			):
							lowerCAmelCase						:   List[Any]							=       self.numpy_arrow_extractor().extract_row(lowerCamelCase__			)
							lowerCAmelCase						:   str							=       self.python_features_decoder.decode_row(lowerCamelCase__			)
							return self.recursive_tensorize(lowerCamelCase__			)





		def  _A							(							self      :		Union[str, Any]  ,					lowerCamelCase__      :		pa.Table			):
							lowerCAmelCase						:   Optional[Any]							=       self.numpy_arrow_extractor().extract_column(lowerCamelCase__			)
							lowerCAmelCase						:   Any							=       self.python_features_decoder.decode_column(lowerCamelCase__  ,					pa_table.column_names[0]			)
							lowerCAmelCase						:   str							=       self.recursive_tensorize(lowerCamelCase__			)
							lowerCAmelCase						:   Tuple							=       self._consolidate(lowerCamelCase__			)
							return column





		def  _A							(							self      :		Any  ,					lowerCamelCase__      :		pa.Table			):
							lowerCAmelCase						:   Dict							=       self.numpy_arrow_extractor().extract_batch(lowerCamelCase__			)
							lowerCAmelCase						:   Tuple							=       self.python_features_decoder.decode_batch(lowerCamelCase__			)
							lowerCAmelCase						:   Dict							=       self.recursive_tensorize(lowerCamelCase__			)
							for column_name in batch:
												lowerCAmelCase						:   Dict							=       self._consolidate(batch[column_name]			)
							return batch


from math import floor, sqrt
def       UpperCAmelCase__							(    __magic_name__  :       int					):


					'''simple docstring'''

					lowerCAmelCase						:   int							=       0.0
					lowerCAmelCase						:   int							=       1.0
					lowerCAmelCase						:   Any							=       int(sqrt(__magic_name__					)					)
					lowerCAmelCase						:   Optional[int]							=       root
					lowerCAmelCase						:   Dict							=       0
					while integer_part != 2 * root:
										lowerCAmelCase						:   str							=       denominator * integer_part - numerator
										lowerCAmelCase						:   Dict							=       (n - numerator**2) / denominator
										lowerCAmelCase						:   str							=       int((root + numerator) / denominator					)
										period += 1
					return period
def       UpperCAmelCase__							(    __magic_name__  :       int = 1_00_00					):


					'''simple docstring'''

					lowerCAmelCase						:   List[str]							=       0
					for i in range(2							,					n + 1					):
										lowerCAmelCase						:   Any							=       sqrt(__magic_name__					)
										if sr - floor(__magic_name__					) != 0 and continuous_fraction_period(__magic_name__					) % 2 == 1:
															count_odd_periods += 1
					return count_odd_periods


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