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



public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[1000003];
        a[0] = n;
        for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        }
        Set<Integer> set = new HashSet<>();
        for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        }
    }

} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[1000003];
        a[0] = n;
        for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        }
        Set<Integer> set = new HashSet<>();
        for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        }
    }

} Main public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[1000003];
        a[0] = n;
        for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        }
        Set<Integer> set = new HashSet<>();
        for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        }
    } main {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[1000003];
        a[0] = n;
        for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        }
        Set<Integer> set = new HashSet<>();
        for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        }
    } @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[1000003]; a new int[1000003] 1000003 a[0] = n a[0] a 0 n for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        } int i = 1 ; int i = 1 ; i 1 i < a.length i a.length a a.length i++ i++ i {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        } {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        } if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            } a[i - 1] % 2 == 0 a[i - 1] % 2 a[i - 1] a i - 1 i 1 2 0 {
                a[i] = a[i - 1] / 2;
            } a[i] = a[i - 1] / 2 a[i] a i a[i - 1] / 2 a[i - 1] a i - 1 i 1 2 {
                a[i] = 3 * a[i - 1] + 1;
            } a[i] = 3 * a[i - 1] + 1 a[i] a i 3 * a[i - 1] + 1 3 * a[i - 1] 3 a[i - 1] a i - 1 i 1 1 Set<Integer> set = new HashSet<>(); set new HashSet<>() for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        } int x a {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        } {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        } if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            } set.contains(x) set.contains set x {
                System.out.println(set.size() + 1);
                return;
            } System.out.println(set.size() + 1) System.out.println System.out System System.out set.size() + 1 set.size() set.size set 1 return; {
                set.add(x);
            } set.add(x) set.add set x String[] args args public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[1000003];
        a[0] = n;
        for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        }
        Set<Integer> set = new HashSet<>();
        for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        }
    }

} public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[1000003];
        a[0] = n;
        for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        }
        Set<Integer> set = new HashSet<>();
        for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        }
    }

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



public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[1000003];
        a[0] = n;
        for (int i = 1 ; i < a.length ; i++) {
            if (a[i - 1] % 2 == 0) {
                a[i] = a[i - 1] / 2;
            } else {
                a[i] = 3 * a[i - 1] + 1;
            }
        }
        Set<Integer> set = new HashSet<>();
        for (int x : a) {
            if (set.contains(x)) {
                System.out.println(set.size() + 1);
                return;
            } else {
                set.add(x);
            }
        }
    }

}