// #include <bits/allocator.h> // Temp fix for gcc13 global pragma
// #pragma GCC target("avx2,bmi2,popcnt,lzcnt")
// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int len = b + 32 - a;
	if(c < len){
		cout << "1\n";
	}
	else if(d < len){
		cout << "2\n";
	}
	else{
		cout << "3\n";
	}
	return 0;
}

/*

*/