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