# Reach 1 with Minimal Operations
## Problem Statement
You are given a positive integer $n$. Your goal is to transform $n$ into $1$ using the minimum number of operations. The following two operations are available:
1. **Halve**: If $n$ is an even number, you may replace $n$ with $n/2$.
2. **Triple-and-Increment**: You may replace $n$ with $3n+1$. This operation is always valid, regardless of whether $n$ is even or odd.
You need to find the minimum number of operations to reach $1$. If $n$ is already $1$, the number of operations is $0$.
## Input Format
A single line contains a positive integer $n$ ($1 \le n \le 10^{12}$).
## Output Format
A single integer representing the minimum number of operations required to transform $n$ into $1$.
## Sample Test Cases
### Sample Input 1
```
6
```
### Sample Output 1
```
8
```
### Sample Input 2
```
1
```
### Sample Output 2
```
0
```
### Sample Input 3
```
7
```
### Sample Output 3
```
16
```
## Constraints
- $1 \le n \le 10^{12}$
- Time limit: 1 second
- Memory limit: 256 MB
## Explanation
### Sample 1: $n=6$
One optimal sequence of operations is:
$6 \to 3 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1$.
This sequence involves $8$ operations.
### Sample 2: $n=1$
The integer $n$ is already $1$, so no operations are needed. The minimum number of operations is $0$.
### Sample 3: $n=7$
One optimal sequence of operations is:
$7 \to 22 \to 11 \to 34 \to 17 \to 52 \to 26 \to 13 \to 40 \to 20 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1$.
This sequence involves $16$ operations.
Loading problem statement...