import java.util.Scanner;

public class PrviZadatakTakmicenje 
{

    public static void main(String[] args) 
    {
        Scanner unos = new Scanner(System.in);
        
        double x1 = unos.nextInt();
        double y1 = unos.nextInt();
        double x2 = unos.nextInt();
        double y2 = unos.nextInt();
        
        int r = 0;
        
        double x = Math.abs(x1 - x2);
        double y = Math.abs(y1 - y2);
        
        if ((y1 == y2)||(x1 == x2))
            r = 2;
        else if(x == y)
            r++;
        
        System.out.println(r);
    }
    
}