#include <bits/stdc++.h>
using namespace std;
int e1,e2,c1,c2;
int main () {
cin>>e1>>c1>>e2>>c2;;
if((c1==c2) or (e1==e2))
cout<<"2";
else if(abs(e1-e2)==abs(c1-c2))
cout<<"1";
else
cout<<"0";
return 0;
}