#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a==c&&b==d)return puts("0"),0;
	if(a+b==c+d||a-b==c-d||abs(a-c)+abs(b-d)<=3)return puts("1"),0;
	if(abs(a-b-c+d)<=3||abs(a+b-c-d)<=3||((a+b)%2)==((c+d)%2))return puts("2"),0;
	puts("3");
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int solve(int sx, int sy, int gx, int gy) {
    if(sx == gx && sy == gy) return 0;
    if(sx + sy == gx + gy) return 1;
    if(sx - sy == gx - gy) return 1;
    if(abs(sx - gx) + abs(sy - gy) <= 3) return 1;
    if((abs(sx - gx) + abs(sy - gy)) % 2 == 0) return 2;
    return 3;
}

int main(){
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;

    int ans = solve(sx, sy, gx, gy);
    REP2(i, -3, 4) {
        REP2(j, -3, 4) {
            if (3 < abs(i) + abs(j)) continue;
            ans = min(ans, solve(sx + i, sy + j, gx, gy) + 1);
        }
    }

    cout << ans << endl;
}
