//
//  a.cpp
//  
//
//  Created by Sagar Singh on 13/12/20.
//

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
typedef unsigned long long ul;
typedef long double ld;
typedef long long ll;
using namespace std;

int check(int a,int b,int c,int d){
    if( a+b == c+d || a-b == c-d || abs(a-c)+abs(b-d) <= 3 ){
        return 1;
    }
    return 0;
}
int main() {
    ll a,b,c,d; cin >> a >> b >> c >> d;
    int ans = 2 + ( (a+b)%2 != (c+d)%2 );
    for(int dx=-3;dx<=+3;++dx){
        for(int dy=-3;dy<=+3;++dy){
            int x = a + dx, y = b + dy;
            if( check(a,b,x,y) && check(x,y,c,d) ){
                ans = 2;
            }
        }
    }
    if( check(a,b,c,d) ){
        ans = 1;
    }
    if( a == c && b == d ){
        ans = 0;
    }
    cout << ans << endl;
}


#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    double a = (double)(sy+gy) / (double)(gx-sx);
    double b = (double)gy - a*(double)gx;
    double x = -b / a; 
    cout << fixed << setprecision(10);
    cout << x;    
}
