object Main extends scala.App {
    import java.util
    import scala.collection._
    import scala.collection.mutable
    import scala.math._

    val sc = new java.util.Scanner(System.in)
    val m1, d1 = sc.nextInt()
    val m2, d2 = sc.nextInt()

    println(if (m1 != m2) 1 else 0)
}