#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll x1,y1,x2,y2;
int ans = 0;
cin >> x1 >> y1 >> x2 >> y2;
if(abs(y2-y1) == abs(x2-x1)){
    ans=1;
}
if(x1==x2 || y1==y2){
    ans=2;
}
cout << ans;
return 0;
}