import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val m1 = sc.nextInt
  val d1 = sc.nextInt
  val m2 = sc.nextInt
  val d2 = sc.nextInt

  val res = if(m1 != m2) "1" else "0"

  println(res)
}