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

int main()
{
    int x1,x2,y1,y2,r1,r2;
    scanf("%d %d\n", &x1, &y1);
    scanf("%d %d", &x2, &y2);
    r1=x2-x1;
    r2=y2-y1;
    if(abs(r1)==abs(r2))
    {
      printf("1\n");
    }
    else if(x1==x2 || y1==y2)
    {
      printf("2\n");
    }
    else
    {
      printf("0\n");  
    }
    return 0;
}