/**         (buri nazar wale tera muh kala 😑)
 *
 * @Author   : rudraksh
 * @Created  : Thursday, November 26th 2020, 8:30:41 pm
 * @Email    : rudrakshk@iitbhilai.ac.in
 *
 *   “Think twice, code once.”
 */


#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef double db;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef map<int,int> MI;
typedef pair<int,PI> PIP;

#define ar array
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define eb emplace_back
#define F first
#define S second
#define repa(i,a,n) for(int i=a;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define pera(i,a,n) for(int i=a;i>=n;i--)
#define per(i,n) for(int i=n;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define loop(it,x) for(auto it=x.begin();it!=x.end();it++)
#define MS0(x) memset((x), 0, sizeof((x)))
#define MS1(x) memset((x), -1, sizeof((x)))
#define CP(dst,src) memcpy(dst, src, sizeof(src))
#define SZ(x) ((ll)(x).size())
#define watch(x) cout << (#x) << " is " << (x) << endl
#define TIME    cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";

const ll mod=1e9+7;
const double pi=acos(-1);

void print() { cout<<'\n'; }
// void print() { cout<<endl; }

template <typename T, typename... Params>
void print(const T& var1, const Params&... var2)
{
    cout<<var1<<' ';
    print(var2...);
}

ll power(ll a,ll b)
{
    if(b==0) return 1;
    ll c = power(a,b/2);
    if(b%2==0) return (c*c)%mod;
    else return (a*((c*c)))%mod;
}


/************************* after all those #defines, finally i can code *****************************/


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a == c && b == d) print(0);
    else if(a+b == c+d) print(1);
    else if(a-b == c-d) print(1);
    else if(abs(a-c) + abs(b-d) <= 3) print(1);
    else if(abs(a-c) <= 5 && abs(b-d) <= 5) print(2);
    else if(abs(abs(c-a) - abs(d-b)) <= 3) print(2);
    else if(((d + (a-c))%2 + 2)%2) print(2);
    else print(3);

    return 0;
}

#include<iostream>
#include<climits>
#define int long long
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define infi INT_MAX
#define rinfi INT_MIN
#define inf LLONG_MAX
#define rinf LLONG_MIN
#define ff first
#define ss second
#ifndef ONLINE_JUDGE
#define line cout<<"here - "<<__LINE__<<"\n";
#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
#define db(a,b) cout<<#a<<" --> "<<(a)<<"\n";cin>>b;
#else
#define line
#define dbg(a)
#define db(a,b)
#endif
char _;
using namespace std;
int r1,r2,c1,c2;
int solve(int x,int y)
{
    if(x==r2 && y==c2)
    return 0;
    if(abs(x-r2)+abs(y-c2)<=3)
        return 1;
    int m1=abs(abs(x-r2)-abs(y-c2));
    int w=0;
    int p=0;
    if(abs(x-r2)==0 || abs(y-c2)==0)
        p=0;
    else p=1;
    if(m1==0)
        return 1;
   if(m1<=3)
    return p+1;
   if(abs(x-r2)%2 != abs(y-c2)%2)
    w=1;
   return w+2;

}
main()
{
    fast
    int tc=1,i,j;
//    cin>>tc;
    while(tc--)
    {
      cin>>r1>>c1>>r2>>c2;
      int ans=inf;
      for(i=-3;i<=3;i++)
      {
          for(j=-3;j<=3;j++)
          {
              if(abs(i)+abs(j)>3)
                continue;
              int x1=r1+i;
              int y1=c1+j;
              int f=0;
              if(x1==r1 && y1==c1)
                f=0;
              else f=1;
              f+=solve(x1,y1);
              ans=min(ans,f);
          }
      }
      cout<<ans<<endl;
    }
}


