object Main extends App{
  val FirstDate = readLine.split(" ").map(_.toInt)
  val SecondDate = readLine.split(" ").map(_.toInt)
  val result:Int = if (FirstDate(1)+1 != SecondDate(1)){1} else{0} 
  println(result)
}