#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int cnt = 0;
while (b >= a) {
if (b % 10 == 1) {
b /= 10;
} else if (b % 2 == 0) {
b /= 2;
} else {
break;
}
cnt++;
}
if (a == b) {
cout << cnt+1 << endl;
} else {
cout << -1 << endl;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: