import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Solution to Laptop Sticker
 *
 * @author vanb
 */
public class sticker_vanb
{
    /** Input. */
    private static Scanner sc;

    /** Output. */
    private static PrintStream ps;

    /**
     * Do it!
     */
    private void doit()
    {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        ps.println( a<x-1 && b<y-1 ? 1 : 0 );
    }

    /**
     * Main.
     *
     * @param args unused
     * @throws Exception
     */
    public static void main( String[] args ) throws Exception
    {
        sc = new Scanner( System.in );
        ps = System.out;

        new sticker_vanb().doit();
    }

}
