#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (c >= 1) c = 1;
  if (a == d && a >= c && d >= c)
    cout << "1";
  else
    cout << "0";
  return 0;
}
