https://www.nowcoder.com/questionTerminal/5ee8df898312465a95553d82ad8898c3
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int x0 = scanner.nextInt();
int count = 0;
while ( x0!=0 &&count < 300000){
x0 = (x0 * 2 + 1) % 1000000007;
count++;
}
int allSteps = helper(count);
System.out.println(allSteps < 100000 ? allSteps : -1);
}
private static int helper(int count) {
if (count % 3 == 0){
return count/3;
}
return count/3 + 1;
}
}