#include <bits/stdc++.h>

using namespace std;

long long x,y,a,b;

int main () {

    cin>>x>>y>>a>>b;

    if (x==a or y==b){
        cout<<2<<endl;
    }
    else if (abs(x-a)==abs(y-b)){
        cout<<1<<endl;
    }
    else{
        cout<<0<<endl;
    }


return 0;
}