



'''simple docstring'''





import html

from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from ...utils import is_bsa_available, logging, requires_backends


if is_bsa_available():
						import bsa
						from bsa import BeautifulSoup


_snake_case	=						logging.get_logger(__name__)



class 						UpperCAmelCase_					( a):







							def __init__(     self,    **__a):

														'''simple docstring'''

														requires_backends(self,    ["bs4"])
														super().__init__(**__a)







							def      snake_case__   (     self,    __a):

														'''simple docstring'''

														_lowerCAmelCase  :							Dict				     =					[]
														_lowerCAmelCase  :							int				     =					[]
														_lowerCAmelCase  :							Optional[Any]				     =					element if element.name else element.parent
														for parent in child.parents:  # type: bs4.element.Tag
																					_lowerCAmelCase  :							Union[str, Any]				     =					parent.find_all(child.name,    recursive=__a)
																					xpath_tags.append(child.name)
																					xpath_subscripts.append(
																					    0 if 1 == len(__a) else next(i for i, s in enumerate(__a,    1) if s is child))
																					_lowerCAmelCase  :							Union[str, Any]				     =					parent
														xpath_tags.reverse()
														xpath_subscripts.reverse()
														return xpath_tags, xpath_subscripts







							def      snake_case__   (     self,    __a):

														'''simple docstring'''

														_lowerCAmelCase  :							List[str]				     =					BeautifulSoup(__a,    "html.parser")

														_lowerCAmelCase  :							Optional[int]				     =					[]
														_lowerCAmelCase  :							List[str]				     =					[]
														_lowerCAmelCase  :							List[Any]				     =					[]

														for element in html_code.descendants:
																					if type(__a) == bsa.element.NavigableString:
																												if type(element.parent) != bsa.element.Tag:
																																			continue

																												_lowerCAmelCase  :							Dict				     =					html.unescape(__a).strip()
																												if not text_in_this_tag:
																																			continue

																												all_doc_strings.append(__a)

																												_lowerCAmelCase  :							List[str]				     =					self.xpath_soup(__a)
																												stringaxtag_seq.append(__a)
																												stringaxsubs_seq.append(__a)

														if len(__a) != len(__a):
																					raise ValueError("Number of doc strings and xtags does not correspond")
														if len(__a) != len(__a):
																					raise ValueError("Number of doc strings and xsubs does not correspond")

														return all_doc_strings, stringaxtag_seq, stringaxsubs_seq







							def      snake_case__   (     self,    __a,    __a):

														'''simple docstring'''

														_lowerCAmelCase  :							int				     =					""
														for tagname, subs in zip(__a,    __a):
																					xpath += f"/{tagname}"
																					if subs != 0:
																												xpath += f"[{subs}]"
														return xpath







							def __call__(     self,    __a):

														'''simple docstring'''

														_lowerCAmelCase  :							Tuple				     =					False

														# Check that strings has a valid type
														if isinstance(__a,    __a):
																					_lowerCAmelCase  :							Dict				     =					True
														elif isinstance(__a,    (list, tuple)):
																					if len(__a) == 0 or isinstance(html_strings[0],    __a):
																												_lowerCAmelCase  :							str				     =					True

														if not valid_strings:
																					raise ValueError(
																					    "HTML strings must of type `str`, `List[str]` (batch of examples), "
																					    f"but is of type {type(__a)}.")

														_lowerCAmelCase  :							Optional[Any]				     =					bool(isinstance(__a,    (list, tuple)) and (isinstance(html_strings[0],    __a)))

														if not is_batched:
																					_lowerCAmelCase  :							Tuple				     =					[html_strings]

														# Get nodes + xpaths
														_lowerCAmelCase  :							Optional[Any]				     =					[]
														_lowerCAmelCase  :							Union[str, Any]				     =					[]
														for html_string in html_strings:
																					_lowerCAmelCase  :							Optional[Any]				     =					self.get_three_from_single(__a)
																					nodes.append(__a)
																					_lowerCAmelCase  :							int				     =					[]
																					for node, tag_list, sub_list in zip(__a,    __a,    __a):
																												_lowerCAmelCase  :							Optional[Any]				     =					self.construct_xpath(__a,    __a)
																												xpath_strings.append(__a)
																					xpaths.append(__a)

														# return as Dict
														_lowerCAmelCase  :							int				     =					{"nodes": nodes, "xpaths": xpaths}
														_lowerCAmelCase  :							Optional[Any]				     =					BatchFeature(data=__a,    tensor_type=__a)

														return encoded_inputs





def        A       (      _lowerCamelCase = 1_000_000						):





							'''simple docstring'''




							_lowerCAmelCase  :							Any				     =					1
							_lowerCAmelCase  :							Optional[Any]				     =					1
							_lowerCAmelCase  :							List[str]				     =					{1: 1}

							for inputa in range(2       ,				_lowerCamelCase						):
														_lowerCAmelCase  :							int				     =					0
														_lowerCAmelCase  :							Any				     =					inputa

														while True:
																					if number in counters:
																												counter += counters[number]
																												break
																					if number % 2 == 0:
																												number //= 2
																												counter += 1
																					else:
																												_lowerCAmelCase  :							Any				     =					(3 * number) + 1
																												counter += 1

														if inputa not in counters:
																					_lowerCAmelCase  :							Tuple				     =					counter

														if counter > pre_counter:
																					_lowerCAmelCase  :							Union[str, Any]				     =					inputa
																					_lowerCAmelCase  :							Union[str, Any]				     =					counter
							return largest_number


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