#include <bits/stdc++.h>
using namespace std;
int a1,a2,b1,b2;
int main(){
cin>>a1>>a2>>b1>>b2;
if(abs(a1-b1)==abs(a2-b2))
    cout<<"1";
else if(a1==b1)
    cout<<"2";
else if(a2==b2)
    cout<<"2";
else
    cout<<"0";

    return 0;
}