#include <bits/stdc++.h>
using namespace std;
long long x1,z1,x2,z2;
int main()
{
    cin>>x1>>z1>>x2>>z2;
    if(x1==x2 or z1==z2){
        cout<<2<<endl;
    }
    else if(abs(x2-x1) == abs(z2-z1)){
        cout<<1<<endl;
    }
    else {
        cout<<0<<endl;
    }
    return 0;
}