import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  int m1, d1, m2, d2;
  readf (" %d %d %d %d", &m1, &d1, &m2, &d2);
  writeln (m1 != m2 ? 1 : 0);
}

