#include<bits/stdc++.h> 
using namespace std;
typedef long long int ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>b)return 0; a=b; return 1;}
#define bitUP(x,a) ((x>>a)&1)
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double EPS = 1e-6;
long double PI = acos(-1);
const ll INF=(1LL<<62);
const int MAX=(1<<30);
constexpr ll MOD=1000000000+7;

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

using pii=pair<int,int>;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using psi=pair<string,int>;
using pis=pair<int,string>;
using psl=pair<string,ll>;
using pls=pair<ll,string>;
using pss=pair<string,string>;

//1-indexed vector cin
template<typename T>
inline void vin1(vector<T> &v){
    for(size_t i=1;i<v.size();i++) cin>>v[i];
}
 
//0-indexed vector cin
template<typename T>
inline void vin0(vector<T> &v){
    for(size_t i=0;i<v.size();i++) cin>>v[i];
}
 
//1-indexed vector<vector> cin
template<typename T>
inline void vin1(vector<vector<T>> &v){
    for(size_t i=1;i<v.size();i++){
        for(size_t j=1;j<v[i].size();j++) cin>>v[i][j];
    }
}
 
//0-indexed vector<vector> cin
template<typename T>
inline void vin0(vector<vector<T>> &v){
    for(size_t i=0;i<v.size();i++){
        for(size_t j=0;j<v[i].size();j++) cin>>v[i][j];
    }
}

//要素数n 初期値x
template<typename T>
inline vector<T> vmake(size_t n,T x){
  return vector<T>(n,x);
}

//a,b,c,x data[a][b][c] 初期値x
template<typename... Args>
auto vmake(size_t n,Args... args){
    auto v=vmake(args...);
    return vector<decltype(v)>(n,move(v));
}

//pair cout
template<typename T, typename U>
inline ostream &operator<<(ostream &os,const pair<T,U> &p) {
  os<<p.first<<" "<<p.second;
  return os;
}
 
//pair cin
template<typename T, typename U>
inline istream &operator>>(istream &is,pair<T,U> &p) {
  is>>p.first>>p.second;
  return is;
}
 
//ソート
template<typename T>
inline void vsort(vector<T> &v){
    sort(v.begin(),v.end());
}
 
//逆順ソート
template<typename T>
inline void rvsort(vector<T> &v){
  sort(v.rbegin(),v.rend());
}

//1ビットの数を返す
inline int popcount(int x){
  return __builtin_popcount(x);
}
//1ビットの数を返す
inline int popcount(ll x){
  return __builtin_popcountll(x);
}

bool flag(ll sx,ll sy,ll gx,ll gy){
    if(sx+sy==gx+gy or sx-sy==gx-gy or abs(sx-gx)+abs(sy-gy)<=3){
        return true;
    }
    return false;
}

void solve(){
    ll sx,sy;
    ll gx,gy;
    cin>>sx>>sy>>gx>>gy;
    if(sx==gx and sy==gy){
        cout<<0<<endl;
        return;
    }
    //1会で行ける場合
    if(flag(sx,sy,gx,gy)){
        cout<<1<<endl;
        return;
    }
    //2会
    if((sx+sy)%2==(gx-gy)%2){
        cout<<2<<endl;
        return;
    }
    for(int i=-3;i<=3;i++){
        for(int j=-3;j<=3;j++){
            if(abs(i)+abs(j)>3) continue;
            if(flag(sx+i,sy+j,gx,gy)){
                cout<<2<<endl;
                return;
            }
        }
    }
    cout<<3<<endl;
}

int main(){
    bin101();
    int T=1;
    //cin>>T;
    while(T--) solve();
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;

int main() {
  long long r1,c1,r2,c2;
  cin >> r1 >> c1;
  cin >> r2 >> c2;
  int ans;
  long long dist = abs(r2-r1)+abs(c2-c1);
  if(dist==0) ans=0;
  else{
    if(dist<=3) ans=1;
    else{
      if(abs(abs(r2-r1)==abs(c2-c1))) ans=1;
      else{
        if(dist%2==0) ans=2;
         else {
           if(abs(abs(r2-r1)-abs(c2-c1))<=3) ans=2;
           else ans=3;
         }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
