#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mk make_pair
#define v_sort(x) sort(x.begin(),x.end())
#define v_gsort(x) sort(x.begin(),x.end(),greater<int>())
#define v_find(x,num) find(x.begin(),x.end(),num)
#define PI 3.14159265
#define MOD 998244353
#define MOD1 1000000007

using namespace std;

void Solve(){
  ll x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  if(x1==x2 || y1==y2) cout<<"2";
  else if(abs(x1-x2)==abs(y1-y2)) cout<<"1";
  else cout<<"0";
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t=1;
//  cin>>t;
  while(t--){
    Solve();
  }
  return 0;
}