#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define single_case solve();
#define line cerr<<"----------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); }
#define mod 1000000007LL




int main()
{
    ios
    int x1, x2, y1, y2;
    cin>>x1>>y1>>x2>>y2;
    if((x1==x2)||(y1==y2))
    {
        cout<<"2";
    }
    else
    {
        if(abs(x1-x2)==abs(y1-y2)) cout<<1;
        else cout<<0;
    }





    return 0;
}