#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;

#define FIO() ios_base::sync_with_stdio(0);cin.tie(NULL);
#define endl '\n'

int main() {
    FIO();

    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    if (r1 == r2 and c1 == c2) {
        cout << 0 << '\n';
        return 0;
    }

    if (abs(r1 - r2) + abs(c1 - c2) <= 3) {
        cout << 1 << '\n';
        return 0;
    }

    if (r1 + c1 == r2 + c2) {
        cout << 1 << '\n';
        return 0;
    }

    if (r1 - c1 == r2 - c2) {
        cout << 1 << '\n';
        return 0;
    }

    if ((r1 + c1) % 2 == (r2 + c2) % 2) {
        cout << 2 << '\n';
        return 0;
    }

    ll ans = 9e18;
    for (int x = -3; x <= 3; x++) {
        for (int y = -3; y <= 3; y++) {
            int rr = r1 + x, cc = c1 + y;
            int d = abs(rr - r1) + abs(cc - c1);
            if (d > 3) continue;
            if ((rr + cc) % 2 != (r2 + c2) % 2) continue;

            ll temp = 1;
            if (abs(rr - r2) + abs(cc - c2) <= 3) {
                temp += 1;
            } else if (rr + cc == r2 + c2) {
                temp += 1;
            } else if (rr - cc == r2 - c2) {
                temp += 1;
            } else temp += 2;

            ans = min(ans, temp);
        }
    }

    cout << ans << '\n';
}

#include <bits/stdc++.h>
#include <cstdint>
using namespace std;

int main() {
  long long A, B, C, D;
  cin >> A >> B;
  cin >> C >> D;
  C -= A;
  D -= B;
  C = abs(C);
  D = abs(D);
  long long x = max(C,D);
  long long y = min(C,D);
  C = x;
  D = y;
  if(x == 0 && y == 0) {
    cout << "0";
  }
  else if(x==y || x+y <= 3) {
    cout << "1";
  }
  else {
    x = (C+D)/2;
    y = (C+D)/2;
    if((C==x&&D==y) || abs(C-x)+abs(D-y) <= 3 || abs(C-x)==abs(D-y)) {
      cout << "2";
    }
    else {
      cout << "3";
    }
  }
}
