Skip to content
UPEEC

Collatz Steps

Easy#math#loops· solved by 0 · time limit 2.0 s

Start from nn. If it is even, halve it; if odd, replace it with 3n+13n+1. Count the steps until you reach 1.

Input

A single integer nn.

Output

The number of steps.

Constraints

1≤n≤1061 \le n \le 10^6

Sample 1

Input

6

Output

8

Sample 2

Input

1

Output

0

Sign in or join free to run and submit your solution.