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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	}
	
	public static Integer function(Integer N) {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	}
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	}
	
	public static Integer function(Integer N) {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	} main {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc HashSet<Integer> integers=new HashSet<Integer>(); integers new HashSet<Integer>() while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		} true {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		} if(!integers.add(N)) {
				break;
			} !integers.add(N) integers.add(N) integers.add integers N {
				break;
			} break; N=function(N) N function(N) function N System.out.println(integers.size()+1) System.out.println System.out System System.out integers.size()+1 integers.size() integers.size integers 1 sc.close() sc.close sc String[] args args public static Integer function(Integer N) {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	} function {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	} if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		} N%2==0 N%2 N 2 0 {
			N=N/2;
		} N=N/2 N N/2 N 2 {
			N=3*N+1;
		} N=3*N+1 N 3*N+1 3*N 3 N 1 return N; N Integer N N public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	}
	
	public static Integer function(Integer N) {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	}
	
	public static Integer function(Integer N) {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	}
} Main
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	}
	
	public static Integer function(Integer N) {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	}
}
