import java.util.Scanner;


public class Absfhjscchbcsdz {

    public static void main(String[] args) {
        int x,y,x1,y1;
        Scanner in=new Scanner(System.in);
        x=in.nextInt();
        y=in.nextInt();
        x1=in.nextInt();
        y1=in.nextInt();
        if((x==x1)||(y==y1)){
            System.out.println(2);
        }
    }
    
}