#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define eps 1e-9
#define INF 2000000000              // 2e9
#define LLINF 2000000000000000000ll // 2e18 (llmax:9e18)
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))

#ifndef LOCAL
#define dmp(...) ;
#else
#define dmp(...)                                                               \
  cerr << "[ " << #__VA_ARGS__ << " ] : " << dump_str(__VA_ARGS__) << endl
#endif

// ---------------- Utility ------------------

template <class T>
bool chmin(T &a, const T &b) {
  if (a <= b) return false;
  a = b;
  return true;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a >= b) return false;
  a = b;
  return true;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;

template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

// ----------------- Input -------------------

template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  return is >> p.first >> p.second;
}

template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}

// ----------------- Output ------------------

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  return os << p.first << ',' << p.second;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (const T &e : v) os << e << " ";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const deque<T> &d) {
  for (const T &e : d) os << e << " ";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const set<T> &s) {
  os << "{ ";
  for (const T &e : s) os << e << " ";
  return os << "}";
}

template <class T, class U>
ostream &operator<<(ostream &os, const map<T, U> &m) {
  os << "{ ";
  for (const auto &[key, val] : m) os << "( " << key << " -> " << val << " ) ";
  return os << "}";
}

void dump_str_rec(ostringstream &) {}

template <class Head, class... Tail>
void dump_str_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << ", " << head;
  dump_str_rec(oss, forward<Tail>(tail)...);
}

template <class T, class... U>
string dump_str(T &&arg, U &&... args) {
  ostringstream oss;
  oss << arg;
  dump_str_rec(oss, forward<U>(args)...);
  return oss.str();
}

// --------------- Fast I/O ------------------

void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

// ------------ End of template --------------

#define endl "\n"

ll get(int x, int y) {
  x = abs(x);
  y = abs(y);
  if (x == 0 && y == 0) return 0;
  ll ret = LLINF;
  for (ll i = -3; i <= 3; i++) {
    for (ll j = -3; j <= 3; j++) {
      if (abs(i) + abs(j) > 3) continue;
      ll nx = x - i;
      ll ny = y - j;
      if (nx == 0 && ny == 0) return 1;
      if (nx == ny) chmin(ret, 2ll);
    }
  }
  if (x == y) return 1;
  if ((x + y) % 2 == 0) return 2;
  if (ret == 2) return 2;
  return 3;
}

void solve() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  c -= a;
  d -= b;
  c = abs(c);
  d = abs(d);
  if (c == d) {
    cout << ((c == 0) ? 0 : 1) << endl;
    return;
  }
  ll ans = LLINF;
  for (ll i = -3; i <= 3; i++) {
    for (ll j = -3; j <= 3; j++) {
      if (abs(i) + abs(j) > 3) continue;
      ll nc = c + i;
      ll nd = d + j;
      ll cost = (i == 0 && j == 0) ? 0 : 1;
      chmin(ans, get(nc, nd) + cost);
    }
  }
  cout << ans << endl;
  return;
}

int main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(a == c && b == d) {
        cout << 0;
        return 0;
    }
    
    if(a + b == c + d || a - b == c - d || abs(a - c) + abs(b - d) <= 3) {
        cout << 1;
        return 0;
    }
    
    if((a + b) % 2 == (c + d) % 2 || abs(a+b-c-d) <= 3 || abs(a-b-c+d) <= 3 || abs(a - c) + abs(b - d) <= 6) {
        cout << 2;
        return 0;
    }
    
    cout << 3;
 
    return 0;
}