





from typing import Dict, Optional, Tuple

import torch






def  SCREAMING_SNAKE_CASE__							(				UpperCamelCase__:							torch.Tensor			):
		SCREAMING_SNAKE_CASE__								=					boundaries[1] - boundaries[0]
		SCREAMING_SNAKE_CASE__								=					boundaries + step / 2
		SCREAMING_SNAKE_CASE__								=					torch.cat([bin_centers, (bin_centers[-1] + step).unsqueeze(-1			)]    ,      dim=0			)
		return bin_centers






def  SCREAMING_SNAKE_CASE__							(				UpperCamelCase__:							torch.Tensor    ,      UpperCamelCase__:							torch.Tensor    ,      ):
		SCREAMING_SNAKE_CASE__								=					_calculate_bin_centers(UpperCamelCase__			)
		return (
		    torch.sum(aligned_distance_error_probs * bin_centers    ,      dim=-1			),
		    bin_centers[-1],
		)






def  SCREAMING_SNAKE_CASE__							(				UpperCamelCase__:							torch.Tensor    ,      UpperCamelCase__:							int = 31    ,      UpperCamelCase__:							int = 64    ,      **UpperCamelCase__:							Tuple    ,      ):
		SCREAMING_SNAKE_CASE__								=					torch.linspace(0    ,      UpperCamelCase__    ,      steps=(no_bins - 1)    ,      device=logits.device			)

		SCREAMING_SNAKE_CASE__								=					torch.nn.functional.softmax(UpperCamelCase__    ,      dim=-1			)
		SCREAMING_SNAKE_CASE__		,  SCREAMING_SNAKE_CASE__								=					_calculate_expected_aligned_error(
		    alignment_confidence_breaks=UpperCamelCase__    ,      aligned_distance_error_probs=UpperCamelCase__    ,      )

		return {
		    "aligned_confidence_probs": aligned_confidence_probs,
		    "predicted_aligned_error": predicted_aligned_error,
		    "max_predicted_aligned_error": max_predicted_aligned_error,
		}






def  SCREAMING_SNAKE_CASE__							(				UpperCamelCase__:							torch.Tensor    ,      UpperCamelCase__:							Optional[torch.Tensor] = None    ,      UpperCamelCase__:							int = 31    ,      UpperCamelCase__:							int = 64    ,      UpperCamelCase__:							float = 1e-8    ,      **UpperCamelCase__:							Dict    ,      ):
		if residue_weights is None:
				SCREAMING_SNAKE_CASE__								=					logits.new_ones(logits.shape[-2]			)

		SCREAMING_SNAKE_CASE__								=					torch.linspace(0    ,      UpperCamelCase__    ,      steps=(no_bins - 1)    ,      device=logits.device			)

		SCREAMING_SNAKE_CASE__								=					_calculate_bin_centers(UpperCamelCase__			)
		torch.sum(UpperCamelCase__			)
		SCREAMING_SNAKE_CASE__								=					logits.shape[-2]
		SCREAMING_SNAKE_CASE__								=					max(UpperCamelCase__    ,      19			)

		SCREAMING_SNAKE_CASE__								=					1.2_4 * (clipped_n - 15) ** (1.0 / 3) - 1.8

		SCREAMING_SNAKE_CASE__								=					torch.nn.functional.softmax(UpperCamelCase__    ,      dim=-1			)

		SCREAMING_SNAKE_CASE__								=					1.0 / (1 + (bin_centers**2) / (da**2))
		SCREAMING_SNAKE_CASE__								=					torch.sum(probs * tm_per_bin    ,      dim=-1			)

		SCREAMING_SNAKE_CASE__								=					residue_weights / (eps + residue_weights.sum())
		SCREAMING_SNAKE_CASE__								=					torch.sum(predicted_tm_term * normed_residue_mask    ,      dim=-1			)

		SCREAMING_SNAKE_CASE__								=					per_alignment * residue_weights

		SCREAMING_SNAKE_CASE__								=					(weighted == torch.max(UpperCamelCase__			)).nonzero()[0]
		return per_alignment[tuple(UpperCamelCase__			)]





'''simple docstring'''







from __future__ import annotations

_lowerCamelCase							:						Union[str, Any]								=  {1: 1}






def 		_lowercase		(	lowercase_  ):



		'''simple docstring'''







		if n in COLLATZ_SEQUENCE_LENGTHS:
				return COLLATZ_SEQUENCE_LENGTHS[n]
		_snake_case	       =       n // 2 if n % 2 == 0 else 3 * n + 1
		_snake_case	       =       collatz_sequence_length(lowercase_  ) + 1
		_snake_case	       =       sequence_length
		return sequence_length






def 		_lowercase		(	lowercase_ = 1000000  ):



		'''simple docstring'''







		_snake_case	       =       max((collatz_sequence_length(lowercase_  ), i) for i in range(1						,							lowercase_  )  )
		return result[1]


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





