#include <iostream>
#include <algorithm>
using namespace std;
int x1,y1,x2,y2;
int main(){
cin>>x1>>y1>>x2>>y2;
if((x1==x2) or (y1==y2))
    cout<<2<<endl;
else if((max(x1,x2)-min(x1,x2))==(max(y1,y2)-min(y1,y2)))
    cout<<1<<endl;
else cout<<0<<endl;
return 0;
}