#include <bits/stdc++.h>
using namespace std;
int main(){
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    int r = r2 - r1, c = c2 - c1;
    int ans = 3;
    if(!r && !c) ans = 0;
    else if(r == c || r == -c || abs(r) + abs(c) <= 3) ans = 1;
    else if((r ^ c ^ 1) & 1 || abs(r + c) <= 3 || abs(r - c) <= 3 || abs(r) + abs(c) <= 6) ans = 2;
    cout << ans << endl;
}
#include<bits/stdc++.h> 
using namespace std; 
 
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define lli long long int
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define pll pair<lli,lli>
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,a,n) for(lli i=a;i<(n);i++)
#define frj(j,a,n) for(lli j=a;j<(n);j++)
#define frx(i,a,n) for(lli i=a;i>(n);i--)
#define frxj(j,a,n) for(lli j=a;j>(n);j--)
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define db(x) cout << "[ " << x << " ]" << endl
#define db2(x,y) cout<<x<<" "<<y<<endl
#define dbarr(arr,a,n) fr(i,a,n) cout<<arr[i]<<" "; cout<<endl
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

lli solve(){
    lli r1,c1,r2,c2;
    cin>>r1>>c1>>r2>>c2;
    if(r1==r2 && c1==c2)return 0;
    if(r1+c1==r2+c2 || r1-r2==c1-c2 || (abs(r1-r2)+abs(c1-c2))<4)return 1;
    if((abs(r1-r2)+abs(c1-c2))<7)return 2;
    if(r2-c2<=r1-(c1-3) && r2-c2>=r1-(c1+3))return 2;
    if(r2+c2<=r1+c1+3 && r2+c2>=r1+c1-3)return 2;
    if((r1+c1)%2==(r2+c2)%2)return 2;
    return 3;
}

int main(){
    fast;
    lli t=1;
    // cin>>t;
    while(t--){
       cout<<solve();
    }
}