#include<bits/stdc++.h>

using namespace std;

long long x,y,xx,yy;

int main(){
cin>>x>>y>>xx>>yy;

if((abs(x-xx)==abs(y-yy))||(abs(x-xx)==0||abs(y-yy)==0)){
if(xx==x||y==yy){
    cout<<2<<endl;
}
else cout<<1<<endl;



} else cout<<0<<endl;


    return 0;
}