#include using namespace std; int main() { set> s; { pair p; cin >> p.first >> p.second; s.insert(p); } for (int64_t ans = 0; ans < 50; ans++) { set> next; for (auto p : s) { if (p.first == p.second) { cerr << p.first << ' ' << p.second << endl; cout << ans << endl; return 0; } next.insert({p.second, p.first}); next.insert({p.first + p.second, p.first - p.second}); } swap(s, next); } cout << -1 << endl; return 0; }