#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
using namespace std;
pair<ll,ll> t1,t2;
int main () {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
cin>>t1.ff>>t1.ss>>t2.ff>>t2.ss;
if(t1.ff==t2.ff or t1.ss==t2.ss){
    cout<<2<<endl;
}
else {
  if(abs(t1.ff-t2.ff)==abs(t1.ss-t2.ss)){
    cout<<1<<endl;
  }
  else {
    cout<<0<<endl;
  }
}
return 0;
}