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

return 0;
}