#include<bits/stdc++.h>
#include<string>
using namespace std;
const int N=1e3+10;
typedef   long long ll;

int n,k,q,m,h,w;
const ll mod=998244353;
int a[N];
int b[N];
map<int,map<int,int> > mp;
set<int> se;
string s;
stack <int> st;
int X[]={-1,-1,-1,0,0,1,1,1};
int Y[]={-1,0,1,-1,1,-1,0,1};

int main()
{
    int r1,c1,r2,c2;
    cin>>r1>>c1;
    cin>>r2>>c2;
    int cha1=abs(r1-r2);
    int cha2=abs(c1-c2);
    int ans;
    int ans1;
    if(r1==r2&&c1==c2){
        cout<<0;
        return 0;
    }
    if(cha1+cha2<=3){
        cout<<1;
        return 0;
    }
    if(cha1==cha2){
        cout<<1;
        return 0;
    }
    if((cha1+cha2)%2==0){
        cout<<2;
        return 0;
    }
    if(abs(cha1-cha2)<=3){
        cout<<2;
        return 0;
    }
    if(cha1+cha2<=6){
        cout<<2;
        return 0;
    }
    cout<<3;

}








#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;

#ifdef __DEBUG__
    void debug_out() { cerr << endl; } 
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) {cerr << " " << H; debug_out(T...);}
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 
#endif

using ll = long long int;
using pii = pair<ll,ll>;
int64_t solve(vector<pii> & a) {
    // TODO: edit here
    ll x = abs(a[1].first - a[0].first);
    ll y = abs(a[1].second - a[0].second);
    if(x==0LL && y==0LL) return 0;
    if(x==y) return 1;
    else if((x+y)<= 3LL) return 1;
    if((((x&1LL)+(y&1LL))&1LL)==1LL){
        if(abs(x-y) <= 6LL) return 2;
        else return 3;
    }
    else{
        return 2;
    }
    return 0;
}

// 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);
    constexpr char endl = '\n';
    // failed to analyze input format
    // TODO: edit here
    vector<pii> a(2);
    REP (i, 2) {
        cin >> a[i].first >> a[i].second;
    }
    auto ans = solve(a);
    cout << ans << endl;
    return 0;
}
