import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); Set set = new HashSet<>(); set.add(n); for (int i = 0; ; i++) { if (n % 2 == 0) { n /= 2; } else { n = 3 * n + 1; } if (n == 1) { System.out.println(i + 1); return; } if (!set.add(n)) { System.out.println("infinity"); return; } } } }