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