#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll x1,x2,y3,y2;
int main(){
    cin>>x1>>y3>>x2>>y2;
    if(x1==x2 or y3==y2)
        cout<<2<<endl;
    else if(abs(x1-x2)==abs(y3-y2))
        cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}