#include <iostream>
using namespace std;

int main()
{
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    int ans = 0;

    if (r1 == r2 && c1 == c2){
        ans = 0;
    }else if (abs(r1 - r2) + abs(c1 - c2) <= 3){
        ans = 1;
    }else if (r1 - r2 + c1 - c2 == 0 || r1 - r2 - c1 + c2 == 0){
        ans = 1;
    }
    else if((r1 + r2 + c1 + c2) % 2 == 0){
        ans = 2;
    }else if ( abs(r1 - r2) + abs(c1 - c2) <= 6){
        ans = 2;
    }else if (abs(r1 + c1 - r2 - c2) <= 3){
        ans = 2;
    }else if (abs(r1 - c1 - r2 + c2) <= 3){
        ans = 2;
    }else{
        ans = 3;
    }
    cout << ans << endl;
}
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define ull unsigned long long
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define debug(x) cerr << #x << " = " << x << '\n';
#define pll pair <ll, ll>
#define fir first
#define sec second
#define INF 0x3f3f3f3f
#define int ll

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

int a,b,c,d;
signed main() {
  IO;
  cin >> a >> b >> c >> d;
  if (a == c && b == d) cout << 0 << '\n';
  else if (a + b == c + d || a - b == c - d) {
    cout << 1 << '\n';
  }else if (abs(a - c) + abs(b - d) <= 3) {
    cout << 1 << '\n';
  }else {
    if ((d - b - c + a) % 2 && abs(abs(d - b) - abs(c - a)) > 3) cout << 3 << '\n';
    else cout << 2 << '\n';
  }
  return 0;
}