#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int x,y,x1,y1;
    cin>>x>>y>>x1>>y1;
    if(x1==x || y1==y)
    {
        cout<<"2";
    }
    else if(abs(x-x1)==abs(y-y1))
    {
        cout<<"1"l
    }
    else{
        cout<<"0";
    }
    
    }