#include<bits/stdc++.h>
using namespace std;
int x,x2,y,y2;
int main()
{
    scanf("%d %d %d %d",&x,&y,&x2,&y2);
    if(abs(x2-x)!=abs(y2-y) and x!=x2 and y!=y2)
    {
        printf("0\n");
        return 0;
    }
    if(abs(y2-y)==abs(x2-x) and (x!=x2 and y!=y2))
    {
        printf("1\n");
        return 0;
    }
    if(x==x2 or y==y2)
    {
        printf("2\n");
        return 0;
    }
    cout<<"0"<<endl;
    return 0;
}