#include<iostream>
using namespace std;
int main()
{
    int x1, y1, x2, y2, k=0, a, b;
    cin>>x1>>y1;
    cin>>x2>>y2;
    a=x2-x1>0?x2-x1:x1-x2;
    b=y2-y1>0?y2-y1:y1-y2;
    if(x1==x2||y1==y2)
        k=2;
    else if(a==b)
        k=1;
    cout<<k;
    return 0;
}