#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

bool move(ll a, ll b, ll c, ll d){
    bool ret = false;
    if(a + b == c + d){
        ret = true;
    }
    else if(a - b == c - d){
        ret = true;
    }
    else if(abs(a-c) + abs(b-d) <= 3){
        ret = true;
    }
    return ret;
}


int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a == c && b == d){
        printf("%d\n", 0);
        return 0;
    }
    if((a+b) % 2 == (c+d) % 2){
        if(move(a, b, c, d)){
            printf("%d\n", 1);
        }
        else{
            printf("%d\n", 2);
        }
    }
    else{
        if(move(a, b, c, d)){
            printf("%d\n", 1);
        }
        else{
            bool ch = false;
            int x[16] = {3,2,2,1,1,1,0,0,0,0,-1,-1,-1,-2,-2,-3};
            int y[16] = {0,-1,1,-2,0,2,-3,-1,1,3,-2,0,2,-1,1,0};
            for (int i = 0; i < 16; i++) {
                if(move(a+x[i], b+y[i], c, d)){
                    ch = true;
                }
            }
            if(ch){
                printf("%d\n", 2);
            }
            else{
                printf("%d\n", 3);
            }
        }
    }

}
#include<iostream>
#include<bits/stdc++.h>
#include <vector>
//#include <string>
using namespace std;
int main(){
  vector <int> number;
  int a;
  cin>>a;
  number.push_back(a);
  cin>>a;
  number.push_back(a);
  cin>>a;
  number.push_back(a);
  sort(number.begin(),number.end());
  if(abs(number[0]-number[1])==abs(number[2]-number[1])){
  cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  
  return(0);
}