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

int main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    auto solve = [&]() -> long long {
        long long p = abs(c - a), q = abs(d - b);
        if (p == 0 && q == 0) return 0;
        if (p == q || p + q <= 3) return 1;
        if ((p + q) % 2 == 0 || p + q <= 6 || abs(p - q) <= 3) return 2;
        return 3; 
    };
    cout << solve() << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define INF 1000000000000
typedef long long ll;

int main()
{
  ll x1, x2, y1, y2, ans = 0;
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  if (x1 == x2 && y1 == y2)
  {
    cout << 0 << endl;
    return 0;
  }
  else if (abs(x1 - x2) + abs(y1 - y2) <= 3)
  {
    cout << 1 << endl;
    return 0;
  }
  int judge1 = (x1 + y1) % 2, judge2 = (x2 + y2) % 2;
  ll diffm1 = x1 - y1, diffp1 = x1 + y1;
  ll diffm2 = x2 - y2, diffp2 = x2 + y2;
  if ((judge1 == 0 && judge2 == 0) || (judge1 == 1 && judge2 == 1))
  {
    if ((diffm1 == diffm2) || (diffp1 == diffp2))
    {
      cout << 1 << endl;
    }
    else
    {
      cout << 2 << endl;
    }
    return 0;
  }
  else
  {
    if ((abs(diffm1 - diffm2) <= 3) || (abs(diffp1 - diffp2) <= 3))
    {
      cout << 2 << endl;
      return 0;
    }

    cout << 3 << endl;
    return 0;
  }
}