





import bisect
import copy
from collections import defaultdict

import numpy as np
from torch.utils.data import BatchSampler, Sampler

from utils import logger





def 		__SCREAMING_SNAKE_CASE						(       UpperCamelCase__    ,    UpperCamelCase__				)						->       str:







			'''simple docstring'''

			UpperCAmelCase     	=       copy.deepcopy(UpperCamelCase__				)
			UpperCAmelCase     	=       sorted(UpperCamelCase__				)
			UpperCAmelCase     	=       [bisect.bisect_right(UpperCamelCase__    ,    UpperCamelCase__				) for y in x]
			return quantized





def 		__SCREAMING_SNAKE_CASE						(       UpperCamelCase__    ,    UpperCamelCase__=0				)						->       List[Any]:







			'''simple docstring'''

			UpperCAmelCase     	=       np.arange(start=3    ,    stop=UpperCamelCase__    ,    step=4				).tolist() if k > 0 else [10]
			UpperCAmelCase     	=       _quantize(UpperCamelCase__    ,    UpperCamelCase__				)
			# count number of elements per group
			UpperCAmelCase     	=       np.unique(UpperCamelCase__    ,    return_counts=UpperCamelCase__				)[1]
			UpperCAmelCase     	=       [0] + bins + [np.inf]
			logger.info('''Using {} as bins for aspect lengths quantization'''.format(UpperCamelCase__				)				)
			logger.info('''Count of instances per bin: {}'''.format(UpperCamelCase__				)				)
			return groups






class 			A_ (a_    ):
	def __init__(					self							,      _A							,      _A							,      _A	):






				'''simple docstring'''







				if not isinstance(_A							,      _A	):
							raise ValueError(
							    '''sampler should be an instance of torch.utils.data.Sampler, but got sampler={}'''.format(_A	)	)
				UpperCAmelCase     	=       sampler
				UpperCAmelCase     	=       group_ids
				UpperCAmelCase     	=       batch_size
	def __iter__(					self	):






				'''simple docstring'''







				UpperCAmelCase     	=       defaultdict(_A	)
				UpperCAmelCase     	=       defaultdict(_A	)

				UpperCAmelCase     	=       0
				for idx in self.sampler:
							UpperCAmelCase     	=       self.group_ids[idx]
							buffer_per_group[group_id].append(_A	)
							samples_per_group[group_id].append(_A	)
							if len(buffer_per_group[group_id]	) == self.batch_size:
										yield buffer_per_group[group_id]  # TODO
										num_batches += 1
										del buffer_per_group[group_id]
							assert len(buffer_per_group[group_id]	) < self.batch_size

				# now we have run out of elements that satisfy
				# the group criteria, let's return the remaining
				# elements so that the size of the sampler is
				# deterministic
				UpperCAmelCase     	=       len(self	)
				UpperCAmelCase     	=       expected_num_batches - num_batches
				if num_remaining > 0:
							# for the remaining batches, group the batches by similar lengths
							UpperCAmelCase     	=       []
							for group_id, idxs in sorted(buffer_per_group.items()							,      key=lambda _A	: x[0]	):
										batch_idx.extend(_A	)
										if len(_A	) >= self.batch_size:
													yield batch_idx[: self.batch_size]
													UpperCAmelCase     	=       batch_idx[self.batch_size :]
													num_remaining -= 1
							if len(_A	) > 0:
										yield batch_idx
										num_remaining -= 1
				assert num_remaining == 0







	def __len__(					self	):






				'''simple docstring'''







				return (len(self.sampler	) + self.batch_size - 1) // self.batch_size










from math import floor, sqrt





def 		__SCREAMING_SNAKE_CASE						(       UpperCamelCase__				)						->       int:







			'''simple docstring'''

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





def 		__SCREAMING_SNAKE_CASE						(       UpperCamelCase__ = 1_0000				)						->       int:







			'''simple docstring'''

			UpperCAmelCase     	=       0
			for i in range(2    ,    n + 1				):
						UpperCAmelCase     	=       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()))}')



