// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 11/22/20 20:12:05
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
constexpr int INF = 2e9;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);

  int a,b,c,d; cin>>a>>b>>c>>d;
  auto dist = [](int a, int b, int c, int d) {
    if (((a+b)%2) != ((c+d)%2))
      return INF;
    if (a==c and b==d)
      return 0;
    if (abs(a-c) == abs(b-d))
      return 1;
    return 2;
  };
  int ans = INF;
  for (int i = a-3; i <= a+3; i++) {
    for (int j = b-3; j <= b+3; j++) {
      if (abs(i-a)+abs(j-b) > 3)
        continue;
      int s = (i==a and j==b) ? 0 : 1;
      for (int k = c-3; k <= c+3; k++) {
        for (int l = d-3; l <= d+3; l++) {
          if (abs(k-c) + abs(d-l) > 3)
            continue;
          int g = (k == c and l == d ? 0 : 1);
          int aux = dist(i,j,k,l);
          if (aux == INF)
            continue;
          ans = min(ans, s+g+aux);
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ll r1, r2, c1, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  ll r = r2-r1, c = c2-c1;
  if (r == 0 && c == 0) cout << 0 << endl;
  else if (r == c || r == -c || abs(r) + abs(c) <= 3) cout << 1 << endl;
  else if ((r+c)%2 == 0 || abs(r+c) <= 3 || abs(r-c) <= 3 || abs(r) + abs(c) <= 6) cout << 2 << endl;
  else cout << 3 << endl;
}
