#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
long long h, w, a, b;
if (cin >> h >> w >> a >> b) {
if (a <= h && b <= w) {
cout << 1 << endl;
}
else if (b <= h && a <= w) {
cout << 2 << endl;
}
else {
cout << 0 << endl;
}
}
return 0;
}