#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int x1,y1,x2,y2;
    scanf("%d",&x1);
    scanf("%d",&y1);
    scanf("%d",&x2);
    scanf("%d",&y2);
    if(x1==x2||y1==y2) printf("2");
    else if(max(x1,x2)-min(x1,x2)==max(y1,y2)-min(y1,y2)) printf("1");
    else printf("0");
}