import java.util.Scanner;
import java.lang.Math;
public class kvadrati {
	public static void main() {
		int x1,x2,y1,y2;
		Scanner s = new Scanner(System.in);
		x1=s.nextInt();
		y1=s.nextInt();
		x2=s.nextInt();
		y2=s.nextInt();
		if(x1==x2&&y1==y2)System.out.println("0");
		else if(x1==x2||y1==y2)System.out.println("2");
		else if(Math.abs(x1-x2)==Math.abs(y1-y2))System.out.println("1");
		else System.out.println("0");
	}
	
	

}