#include <bits/stdc++.h>

#define ll long long
#define ar array

#define ff first 
#define ss second 
#define mp make_pair

#define pb push_back

#define rep(i,n) for(auto i=0; i<(n); i++) 

#define all(x) (x).begin(), (x).end() 

using namespace std;

typedef  map<string,int>         msi; 
typedef  map<int,int>	         mii; 
typedef  map<ll, ll>             mll; 
typedef  map<char,int>           mci; 
typedef  map<int,string>	     mis; 
typedef  pair<int,int> 	         pii;
typedef  pair<ll, ll> 	         pll;  
typedef  pair<string, int>       psi; 
typedef  pair<string, string>    pss; 
typedef  vector<int> 	         vi;  
typedef  vector<string> 	     vs; 
typedef  vector<char>	         vc; 
typedef  vector<bool>            vb; 
typedef  vector< pii >           vii;
typedef  vector< ll >            vll;
typedef  vector<pii>             vpii;
typedef  vector<pll>             vpll;
typedef  vector<vi>              vvi;
typedef  vector<vll>             vvll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if(x1 == x2 && y1 == y2) cout << 0;
    else if(x1 == x2 || y1==y2) cout << 2;
    else if(abs(x1-x2) == abs(y1-y2)) cout << 1;
    else cout << 0;

    return 0;
}