import java.util.*;

public class Main {
	final static int MMAX = 1000000;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		sc.close();
		int ans = 0;
		long[] a = new long[MMAX+1];
		a[1] = s;
		HashMap<Long, Integer> amap = new HashMap<>();
		amap.put(a[1], 1);
		for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	final static int MMAX = 1000000;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		sc.close();
		int ans = 0;
		long[] a = new long[MMAX+1];
		a[1] = s;
		HashMap<Long, Integer> amap = new HashMap<>();
		amap.put(a[1], 1);
		for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
} Main final static int MMAX = 1000000; MMAX 1000000 public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		sc.close();
		int ans = 0;
		long[] a = new long[MMAX+1];
		a[1] = s;
		HashMap<Long, Integer> amap = new HashMap<>();
		amap.put(a[1], 1);
		for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	} main {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		sc.close();
		int ans = 0;
		long[] a = new long[MMAX+1];
		a[1] = s;
		HashMap<Long, Integer> amap = new HashMap<>();
		amap.put(a[1], 1);
		for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	} int i i j; j Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = Integer.parseInt(sc.next()); s Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc int ans = 0; ans 0 long[] a = new long[MMAX+1]; a new long[MMAX+1] MMAX+1 MMAX 1 a[1] = s a[1] a 1 s HashMap<Long, Integer> amap = new HashMap<>(); amap new HashMap<>() amap.put(a[1], 1) amap.put amap a[1] a 1 1 for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		} i=2; i=2 i 2 i<=MMAX i MMAX i++ i++ i {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		} {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		} 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 Integer ii = amap.get(a[i]); ii amap.get(a[i]) amap.get amap a[i] a i if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			} ii == null ii null {
				amap.put(a[i], i);
			} amap.put(a[i], i) amap.put amap a[i] a i i {
				ans = i;
				break;
			} ans = i ans i break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	final static int MMAX = 1000000;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		sc.close();
		int ans = 0;
		long[] a = new long[MMAX+1];
		a[1] = s;
		HashMap<Long, Integer> amap = new HashMap<>();
		amap.put(a[1], 1);
		for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	final static int MMAX = 1000000;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		sc.close();
		int ans = 0;
		long[] a = new long[MMAX+1];
		a[1] = s;
		HashMap<Long, Integer> amap = new HashMap<>();
		amap.put(a[1], 1);
		for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main {
	final static int MMAX = 1000000;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		sc.close();
		int ans = 0;
		long[] a = new long[MMAX+1];
		a[1] = s;
		HashMap<Long, Integer> amap = new HashMap<>();
		amap.put(a[1], 1);
		for(i=2;i<=MMAX;i++) {
			if(a[i-1]%2==0) {
				a[i] = a[i-1]/2;
			} else {
				a[i] = 3*a[i-1]+1; 
			}
			Integer ii = amap.get(a[i]);
			if(ii == null) {
				amap.put(a[i], i);
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
}
