function Main(input) {
   	var inputArray = input.split("\n");
	var inputLine=inputArray[0].split(" ");
	var M1=inputLine[0]*1;
	var D1=inputLine[1]*1;
	var inputLine=inputArray[1].split(" ");	
	var M2=inputLine[0]*1;
	var D2=inputLine[1]*1;
	
	if(D2==D1+1){
		console.log("0");
	}else{
		console.log("1");		
	}
}
     
Main(require("fs").readFileSync("/dev/stdin", "utf8"));