#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define PB push_back
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define MAX (int)1e6
#define Fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define w(a) cout<<#a<<" : "<<a<<endl;
#define ldb long double
#define vi vector<int>
#define pii pair<int,int>
#define pdi pair<ldb,int>
#define N 1450
#define INF (int)1'450'000

/// prvi

int solve()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-b)==abs(c-d)) return 1;
    if(a==c || b==d) return 2;
    return 0;
}

int main()
{
    Fast;
    cout<<solve();
    return 0;
}