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();
        int d2=(x - x1) * (x - x1) + (y - y) * (y - y); 
        int d3=(x - x1) * (x - x1) + (y - y1) * (y - y1); 
        int d4=(x - x) * (x - x) + (y - y1) * (y - y1); 
        int p4=(x1 - x) * (x1 - x) + (y - y1) * (y - y1); 
        int p3=(x1 - x1) * (x1 - x1) + (y - y1) * (y - y1);
        int p1=(x1 - x1) * (x1 - x1) + (y1 - y) * (y1 - y);
        int p2=(x1 - x) * (x1 - x) + (y1 - y1) * (y1 - y1);
        
        if((x==x1)||(y==y1)){
            System.out.println(2);
        }
        else if (d2 == 0 || d3 == 0 || d4 == 0)     
        System.out.println(0);
  
    if (d2 == d3 && 2 * d2 == d4 && 2 *p4 == p3){ 
        System.out.println(1);
    } 
    else if (d3 == d4 && 2 * d3 == d2 && 2 * p1 == p2){ 
        System.out.println(1);
    } 
    else if (d2 == d4 && 2 * d2 == d3 && 2 *p3==  p4){ 
        System.out.println(1);
    } 
    else {
        System.out.println(0);
    }
    }
}