


from manim import *






class 				snake_case__(							a__							):







						'''simple docstring'''




						def 						lowercase_ (				self							)					->    Union[str, Any]:
										lowerCAmelCase_ :      Tuple    				=				Rectangle(height=0.5   ,						width=0.5							)
										lowerCAmelCase_ :      Tuple    				=				Rectangle(height=0.46   ,						width=0.46							).set_stroke(width=0							)

										lowerCAmelCase_ :      List[Any]    				=				[mem.copy() for i in range(6							)]
										lowerCAmelCase_ :      str    				=				[mem.copy() for i in range(6							)]
										lowerCAmelCase_ :      str    				=				VGroup(*lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0							)
										lowerCAmelCase_ :      Tuple    				=				VGroup(*lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0							)
										lowerCAmelCase_ :      int    				=				VGroup(lowerCamelCase_   ,						lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0							)
										lowerCAmelCase_ :      str    				=				Text('''CPU'''   ,						font_size=2_4							)
										lowerCAmelCase_ :      Any    				=				Group(lowerCamelCase_   ,						lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0.5   ,						aligned_edge=lowerCamelCase_							)
										cpu.move_to([-2.5, -0.5, 0]							)
										self.add(lowerCamelCase_							)

										lowerCAmelCase_ :      Optional[Any]    				=				[mem.copy() for i in range(4							)]
										lowerCAmelCase_ :      Dict    				=				VGroup(*lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0							)
										lowerCAmelCase_ :      Union[str, Any]    				=				Text('''GPU'''   ,						font_size=2_4							)
										lowerCAmelCase_ :      List[str]    				=				Group(lowerCamelCase_   ,						lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0.5   ,						aligned_edge=lowerCamelCase_							)
										gpu.move_to([-1, -1, 0]							)
										self.add(lowerCamelCase_							)

										lowerCAmelCase_ :      Optional[Any]    				=				[mem.copy() for i in range(6							)]
										lowerCAmelCase_ :      Dict    				=				VGroup(*lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0							)

										lowerCAmelCase_ :      Optional[Any]    				=				Text('''Model'''   ,						font_size=2_4							)
										lowerCAmelCase_ :      str    				=				Group(lowerCamelCase_   ,						lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0.5   ,						aligned_edge=lowerCamelCase_							)
										model.move_to([3, -1.0, 0]							)
										self.add(lowerCamelCase_							)

										lowerCAmelCase_ :      Dict    				=				[]
										for i, rect in enumerate(lowerCamelCase_							):
														rect.set_stroke(lowerCamelCase_							)
														# target = fill.copy().set_fill(YELLOW, opacity=0.7)
														# target.move_to(rect)
														# self.add(target)

														lowerCAmelCase_ :      Optional[int]    				=				Rectangle(height=0.46 / 4   ,						width=0.46 / 3							).set_stroke(width=0.0							).set_fill(lowerCamelCase_   ,						opacity=0.7							)

														if i == 0:
																		cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT							)   ,						buff=0.02   ,						direction=lowerCamelCase_							)
																		cpu_target.set_x(cpu_target.get_x() + 0.1							)
														elif i == 3:
																		cpu_target.next_to(cpu_targs[0]   ,						direction=lowerCamelCase_   ,						buff=0.0							)
														else:
																		cpu_target.next_to(cpu_targs[i - 1]   ,						direction=lowerCamelCase_   ,						buff=0.0							)
														self.add(lowerCamelCase_							)
														cpu_targs.append(lowerCamelCase_							)

										lowerCAmelCase_ :      Optional[int]    				=				[mem.copy() for i in range(6							)]
										lowerCAmelCase_ :      Optional[int]    				=				VGroup(*lowerCamelCase_							).arrange(lowerCamelCase_   ,						buff=0							)

										lowerCAmelCase_ :      List[str]    				=				Text('''Loaded Checkpoint'''   ,						font_size=2_4							)
										lowerCAmelCase_ :      Any    				=				Group(lowerCamelCase_   ,						lowerCamelCase_							).arrange(lowerCamelCase_   ,						aligned_edge=lowerCamelCase_   ,						buff=0.4							)
										checkpoint.move_to([3, 0.5, 0]							)

										lowerCAmelCase_ :      Optional[Any]    				=				Square(side_length=2.2							)
										key.move_to([-5, 2, 0]							)

										lowerCAmelCase_ :      Tuple    				=				MarkupText(
										    f"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""   ,						font_size=1_8   ,						)

										key_text.move_to([-5, 2.4, 0]							)

										self.add(lowerCamelCase_   ,						lowerCamelCase_							)

										lowerCAmelCase_ :      str    				=				MarkupText(
										    f"""<span fgcolor='{BLUE}'>●</span> Checkpoint"""   ,						font_size=1_8   ,						)

										blue_text.next_to(lowerCamelCase_   ,						DOWN * 2.4   ,						aligned_edge=key_text.get_left()							)

										lowerCAmelCase_ :      List[str]    				=				MarkupText(
										    f"""Next, a <i><span fgcolor=\"{BLUE}\">second</span></i> model is loaded into memory,\nwith the weights of a <span fgcolor=\"{BLUE}\">single shard</span>."""   ,						font_size=2_4   ,						)
										step_a.move_to([2, 2, 0]							)
										self.play(Write(lowerCamelCase_							)   ,						Write(lowerCamelCase_							)							)

										self.play(Write(lowerCamelCase_   ,						run_time=1							)   ,						Create(lowerCamelCase_   ,						run_time=1							)							)

										lowerCAmelCase_ :      Union[str, Any]    				=				[]
										lowerCAmelCase_ :      Any    				=				[]
										for i, rect in enumerate(lowerCamelCase_							):
														lowerCAmelCase_ :      Optional[int]    				=				fill.copy().set_fill(lowerCamelCase_   ,						opacity=0.7							)
														target.move_to(lowerCamelCase_							)
														first_animations.append(GrowFromCenter(lowerCamelCase_   ,						run_time=1							)							)

														lowerCAmelCase_ :      str    				=				target.copy()
														cpu_target.generate_target()
														if i < 5:
																		cpu_target.target.move_to(cpu_left_col_base[i + 1]							)
														else:
																		cpu_target.target.move_to(cpu_right_col_base[i - 5]							)
														second_animations.append(MoveToTarget(lowerCamelCase_   ,						run_time=1.5							)							)

										self.play(*lowerCamelCase_							)
										self.play(*lowerCamelCase_							)
										self.wait()



def 			lowerCAmelCase (		lowerCAmelCase_ = 1_000_000 )-> int:
				lowerCAmelCase_ :      Dict    				=				1
				lowerCAmelCase_ :      List[Any]    				=				1
				lowerCAmelCase_ :      Optional[Any]    				=				{1: 1}

				for inputa in range(2 ,   lowerCAmelCase_ ):
								lowerCAmelCase_ :      Tuple    				=				0
								lowerCAmelCase_ :      Dict    				=				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_ :      Optional[int]    				=				inputa
												lowerCAmelCase_ :      Union[str, Any]    				=				counter
				return largest_number


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