import java.util.Scanner;

public class Kvadrati {

    public static void main(String[] args) {
        int x1,x2,y1,y2;
        Scanner input=new Scanner(System.in);
        x1=input.nextInt();
        y1=input.nextInt();
        x2=input.nextInt();
        y2=input.nextInt();
        int brK=0;
        if(x1==x2){
            brK=2;
        }
        else if(y1==y2){
            brK=2;
        }
        else if((x1!=x2)&&(y1!=y2)){
            brK=1;
        }
        System.out.println(brK);
    }
    
}