/* by: senb1 */ #include #define ll long long #define all(x) x.begin(), x.end() #define fr first #define sc second #define mk make_pair using namespace std; const ll mod = 1e9 + 7; const ll maxn = 1e8; const ll inf = 1e9 + 6; void solve() { int a, b; cin >> a >> b; if (a > b) swap(a, b); int c = 1, ans = 0; while (a * c != b) { if (a * c <= b) { c++; ans++; // cout << c << endl; } if (a * c > b) { a--; ans++; // cout << a << endl; } } cout << ans << endl; } /* 10 17 32 73 134 225 */ int main() { ios::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; while (t--) solve(); }