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

int r1, c1, r2, c2;

void solve() {
  if (r1 == r2 && c1 == c2) {
    printf("0\n");
    return;
  }
  if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2 || abs(r1 - r2) + abs(c1 - c2) <= 3) {
    printf("1\n");
    return;
  }
  if ((r1 + c1 + r2 + c2) % 2 == 0 || abs(r1 - r2) + abs(c1 - c2) <= 6 || abs((r1 + c1) - (r2 + c2)) <= 3 ||
      abs((r1 - c1) - (r2 - c2)) <= 3) {
    printf("2\n");
    return;
  }
  printf("3\n");
}

int main() {
  cin >> r1 >> c1 >> r2 >> c2;
  solve();
}
#include <bits/stdc++.h>
using namespace std;

int r1, c1, r2, c2;

bool is_in(int x, int y) {
    if (r1 + c1 == x + y || c1 - r1 == y - x || abs(r1 - x) + abs(c1 - y) <= 3) return true;
    return false;
}

int main() {
    int ans;
    scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
    if (r1 == r2 && c1 == c2) ans = 0;
    else if (is_in(r2, c2)) ans = 1;
    else {
        bool flag = false;
        for (int i = r2 - 2; i <= r2 + 2; ++i)
            for (int j = c2 - 2; j <= c2 + 2; ++j)
                if (is_in(i, j)) flag = true;
        if (is_in(r2 - 3, c2)) flag = true;
        if (is_in(r2 + 3, c2)) flag = true;
        if (is_in(r2, c2 - 3)) flag = true;
        if (is_in(r2, c2 + 3)) flag = true;
        if (((r1 + c1) & 1) == ((r2 + c2) & 1)) flag = true;
        if (flag) ans = 2;
        else ans = 3;
    }
    printf("%d", ans);
    return 0;
}