#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
constexpr ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
template<class T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b){ if(b<a){ a=b; return 1; } return 0; }
constexpr int dy[4]={ -1,0,1,0 };
constexpr int dx[4]={ 0,-1,0,1 };

ll a1, b1, a2, b2;

signed main(){
    cin >> a1 >> b1 >> a2 >> b2;
    if((a1+b1)%2 == (a2+b2)%2){
        if(a1 == a2 && b1 == b2){
            cout << 0 << endl;
        }
        else if(a1+b1 == a2+b2 || a1-b1 == a2-b2 || abs(a1-a2)+abs(b1-b2) <= 3){
            cout << 1 << endl;
        }
        else{
            cout << 2 << endl;
        }
    }
    else{
        if(abs(a1-a2)+abs(b1-b2) <= 3){
            cout << 1 << endl;
        }
        else if(abs((a1+b1)-(a2+b2)) <= 3 || abs((a1-b1)-(a2-b2)) <= 3 || abs(a1-a2)+abs(b1-b2) <= 6){
            cout << 2 << endl;
        }
        else{
            cout << 3 << endl;
        }
    }
}
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pp=pair<int,int>;
const ll INF=1e9;
const ll mod=1e9+7;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x=c-a, y=d-b;
  int s;
  if (x==0 && y==0) {s=0; goto OUT;}
  else if (abs(x)==abs(y) || (abs(x)<=2 && abs(y)<=2) || (abs(x)==3 && y==0) || (abs(y)==3 && x==0)) {
    s=1;
    goto OUT;
  }
  else if (x%2==y%2) {s=2; goto OUT;}
  else {
    queue<pp> Q;
    for (int i=-2; i<=2; i++) {
      for (int j=-2; j<=2; j++) {
        Q.push(pp(x+i,y+j));
      }
    }
    Q.push(pp(x,y+3));
    Q.push(pp(x,y-3));
    Q.push(pp(x+3,y));
    Q.push(pp(x-3,y));
    while (Q.size()>0) {
      pp q=Q.front();
      Q.pop();
      x=q.first;
      y=q.second;
      if (abs(x)==abs(y) || (abs(x)<=2 && abs(y)<=2) || (abs(x)==3 && y==0) || (abs(y)==3 && x==0)) {
        s=2;
        goto OUT;
      }
    }
  }
  s=3;
OUT:
  cout << s << endl;
}