import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    } main {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) boolean a[] = new boolean[1000001]; a new boolean[1000001] 1000001 int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        } int i = 1; int i = 1; i 1 i<1000000 i 1000000 i++ i++ i {
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        } {
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        } a[tmp] = true a[tmp] a tmp true if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            } tmp % 2 == 0 tmp % 2 tmp 2 0 {
                tmp = tmp/2;
            } tmp = tmp/2 tmp tmp/2 tmp 2 {
                tmp = tmp*3+1;
            } tmp = tmp*3+1 tmp tmp*3+1 tmp*3 tmp 3 1 if(a[tmp] == true){
                tmp = i+1;
                break;
            } a[tmp] == true a[tmp] a tmp true {
                tmp = i+1;
                break;
            } tmp = i+1 tmp i+1 i 1 break; System.out.println(tmp) System.out.println System.out System System.out tmp String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean a[] = new boolean[1000001];
        int tmp = sc.nextInt();
        
        for(int i = 1;i<1000000;i++){
            a[tmp] = true;

            if(tmp % 2 == 0){
                tmp = tmp/2;
            }else{
                tmp = tmp*3+1;
            }

            if(a[tmp] == true){
                tmp = i+1;
                break;
            }
        }

        System.out.println(tmp);
    }
}