#!/bin/bash
":" //#; docker run --rm -it -v "$(cd $(dirname $0) && pwd)":/vo:ro  node:5.2-slim /bin/bash -c "node /vo/$(basename $0) < /vo/g.inp"; exit $?

"use strict";
let main = (input) => {
    let lst = input.split("\n");
    let m1 = lst[0].split(" ")[0];
    let m2 = lst[1].split(" ")[0];
    if(m1===m2) {
	return 0;
    } else {
	return 1;
    };
};
console.log(main(require("fs").readFileSync("/dev/stdin", "utf-8").trim()));
