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