


import math

import torch
from torch import nn
from torch.nn import init

from .binarizer import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer


class        __lowerCamelCase      (				nn.Linear ):


				"""simple docstring"""







				def __init__(				self     :    List[str]	,							lowerCamelCase_     :    int	,							lowerCamelCase_     :    int	,							lowerCamelCase_     :    bool = True	,							lowerCamelCase_     :    str = "constant"	,							lowerCamelCase_     :    float = 0.0	,							lowerCamelCase_     :    str = "topK"	,							):
								super(lowerCamelCase_	,							self					).__init__(in_features=lowerCamelCase_	,							out_features=lowerCamelCase_	,							bias=lowerCamelCase_					)
								assert pruning_method in ["topK", "threshold", "sigmoied_threshold", "magnitude", "l0"]
								_lowerCAmelCase  						=pruning_method

								if self.pruning_method in ["topK", "threshold", "sigmoied_threshold", "l0"]:
												_lowerCAmelCase  						=mask_scale
												_lowerCAmelCase  						=mask_init
												_lowerCAmelCase  						=nn.Parameter(torch.empty(self.weight.size()					)					)
												self.init_mask()






				def        lowerCAmelCase__			(				self     :    Optional[int]					):
								if self.mask_init == "constant":
												init.constant_(self.mask_scores	,							val=self.mask_scale					)
								elif self.mask_init == "uniform":
												init.uniform_(self.mask_scores	,							a=-self.mask_scale	,							b=self.mask_scale					)
								elif self.mask_init == "kaiming":
												init.kaiming_uniform_(self.mask_scores	,							a=math.sqrt(5					)					)






				def        lowerCAmelCase__			(				self     :    int	,							lowerCamelCase_     :    torch.tensor	,							lowerCamelCase_     :    float					):
								# Get the mask
								if self.pruning_method == "topK":
												_lowerCAmelCase  						=TopKBinarizer.apply(self.mask_scores	,							lowerCamelCase_					)
								elif self.pruning_method in ["threshold", "sigmoied_threshold"]:
												_lowerCAmelCase  						="""sigmoied""" in self.pruning_method
												_lowerCAmelCase  						=ThresholdBinarizer.apply(self.mask_scores	,							lowerCamelCase_	,							lowerCamelCase_					)
								elif self.pruning_method == "magnitude":
												_lowerCAmelCase  						=MagnitudeBinarizer.apply(self.weight	,							lowerCamelCase_					)
								elif self.pruning_method == "l0":
												_lowerCAmelCase						,							_lowerCAmelCase						,							_lowerCAmelCase  						=-0.1, 1.1, 2 / 3
												if self.training:
																_lowerCAmelCase  						=torch.zeros_like(self.mask_scores					).uniform_().clamp(0.0001	,							0.9999					)
																_lowerCAmelCase  						=torch.sigmoid((u.log() - (1 - u).log() + self.mask_scores) / b					)
												else:
																_lowerCAmelCase  						=torch.sigmoid(self.mask_scores					)
												_lowerCAmelCase  						=s * (r - l) + l
												_lowerCAmelCase  						=s_bar.clamp(min=0.0	,							max=1.0					)
								# Mask weights with computed mask
								_lowerCAmelCase  						=mask * self.weight
								# Compute output (linear layer) with masked weights
								return nn.functional.linear(lowerCamelCase_	,							lowerCamelCase_	,							self.bias					)





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

