#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { ll a, b, nat, unat; cin >> a >> b; nat = min(a, b); unat = abs(a - b); cout << (((nat*2 - unat) < 0) ? unat - nat*2 : (abs(nat*2 - unat)%2) ? 1 : (abs(max(a, b)- nat*3)%2 || (a == b && a%2)) ? 2 : 0) << endl; }