import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    static Set<Integer> MEMO = new HashSet<>();

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        MEMO.add(a);
        solve(a);

        System.out.println(MEMO.size() + 1);

    }

    private static void solve(int a) {
        int tmp = 0;
        if (a % 2 == 0) {
            tmp = a / 2;
        } else {
            tmp = 3 * a + 1;
        }

        if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        }

        solve(tmp);
    }
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {

    static Set<Integer> MEMO = new HashSet<>();

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        MEMO.add(a);
        solve(a);

        System.out.println(MEMO.size() + 1);

    }

    private static void solve(int a) {
        int tmp = 0;
        if (a % 2 == 0) {
            tmp = a / 2;
        } else {
            tmp = 3 * a + 1;
        }

        if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        }

        solve(tmp);
    }
} Main static Set<Integer> MEMO = new HashSet<>(); MEMO new HashSet<>() public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        MEMO.add(a);
        solve(a);

        System.out.println(MEMO.size() + 1);

    } main {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        MEMO.add(a);
        solve(a);

        System.out.println(MEMO.size() + 1);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc MEMO.add(a) MEMO.add MEMO a solve(a) solve a System.out.println(MEMO.size() + 1) System.out.println System.out System System.out MEMO.size() + 1 MEMO.size() MEMO.size MEMO 1 String[] args args private static void solve(int a) {
        int tmp = 0;
        if (a % 2 == 0) {
            tmp = a / 2;
        } else {
            tmp = 3 * a + 1;
        }

        if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        }

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

        if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        }

        solve(tmp);
    } int tmp = 0; tmp 0 if (a % 2 == 0) {
            tmp = a / 2;
        } else {
            tmp = 3 * a + 1;
        } a % 2 == 0 a % 2 a 2 0 {
            tmp = a / 2;
        } tmp = a / 2 tmp a / 2 a 2 {
            tmp = 3 * a + 1;
        } tmp = 3 * a + 1 tmp 3 * a + 1 3 * a 3 a 1 if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        } MEMO.contains(tmp) MEMO.contains MEMO tmp {
            return;
        } return; {
            MEMO.add(tmp);
        } MEMO.add(tmp) MEMO.add MEMO tmp solve(tmp) solve tmp int a a public class Main {

    static Set<Integer> MEMO = new HashSet<>();

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        MEMO.add(a);
        solve(a);

        System.out.println(MEMO.size() + 1);

    }

    private static void solve(int a) {
        int tmp = 0;
        if (a % 2 == 0) {
            tmp = a / 2;
        } else {
            tmp = 3 * a + 1;
        }

        if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        }

        solve(tmp);
    }
} public class Main {

    static Set<Integer> MEMO = new HashSet<>();

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        MEMO.add(a);
        solve(a);

        System.out.println(MEMO.size() + 1);

    }

    private static void solve(int a) {
        int tmp = 0;
        if (a % 2 == 0) {
            tmp = a / 2;
        } else {
            tmp = 3 * a + 1;
        }

        if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        }

        solve(tmp);
    }
} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    static Set<Integer> MEMO = new HashSet<>();

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        MEMO.add(a);
        solve(a);

        System.out.println(MEMO.size() + 1);

    }

    private static void solve(int a) {
        int tmp = 0;
        if (a % 2 == 0) {
            tmp = a / 2;
        } else {
            tmp = 3 * a + 1;
        }

        if (MEMO.contains(tmp)) {
            return;
        } else {
            MEMO.add(tmp);
        }

        solve(tmp);
    }
}
