#include <cmath>
#include <iostream>
#include <string>

using namespace std;

long long r1, c1, r2, c2, x, y;

int main() {
  cin >> r1 >> c1 >> r2 >> c2;
  x = abs(r1 - r2);
  y = abs(c1 - c2);
  if (r1 == r2 && c1 == c2) {
    cout << 0;
  } else if (y == x || x + y <= 3) {
    cout << 1;
  } else if ((x + y) % 2 == 0 || x + y <= 6 || abs(x - y) <= 3) {
    cout << 2;
  } else {
    cout << 3;
  }
  return 0;
}
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i))
#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;

template <typename T>
void print_vector(T& vec) {
    stringstream ss;
    ss << "{";
    for (auto v : vec) ss << v << " ";
    ss << "}" << endl;
    cout << ss.str() << endl;
}

template <typename T>
void print_pairs(T& vec) {
    stringstream ss;
    ss << "{";
    for (auto v : vec) ss << v.first << "," << v.second << " ";
    ss << "}" << endl;
    cout << ss.str() << endl;
}

template <typename T>
string string_vector(vector<T>& vec) {
    stringstream ss;
    ss << "{";
    for (auto v : vec) ss << v << " ";
    ss << "}\n";
    return ss.str();
}

template <typename T>
string string_vector(vector<vector<T>>& vec) {
    stringstream ss;
    ss << "{";
    for (auto v : vec) {
        ss << "{";
        for (auto vv : v) ss << vv << " ";
        ss << "}";
    }
    ss << "}\n";
    return ss.str();
}

using ll = long long;
class Solution {
   public:
    ll solve(int r1, int c1, int r2, int c2) {
        // cout << "r1=" << r1 << " c1="<< c1 << " r2=" << r2 << " c2=" << c2 << endl;

        if(r1==r2 and c1==c2) return 0;
        if(abs(r1-r2) == abs(c1-c2)) return 1;
        // cout << "r1-r2=" << abs(r1-r2) % 2 << " c1-c2="<< abs(c1-c2) % 2 << endl;
        if( abs(r1-r2) + abs(c1-c2) <=3) return 1;
        if( (abs(r1-r2) % 2) == (abs(c1-c2) % 2) ) return 2;
        if( abs( abs(r1-r2) - (abs(c1-c2) ))<=3) return 2;
        
        
        return 3;
    }
};

// generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    Solution sol;
    // failed to analyze input format
    // TODO: edit here
    int r1, c1, r2, c2;
    cin >> r1>> c1>> r2>>c2 ;
    auto ans = sol.solve(r1, c1, r2, c2);
    cout << ans << endl;
    return 0;
}
