#include <iostream>
#include <math.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	long long x,y,xx,yy;
	cin>>x>>y>>xx>>yy;
	long long a,b;
	if(x==xx or y==yy){
		cout<<2;
		return 0;
	}
	else{
		a=abs(x-xx);
		b=abs(y-yy);
		//cout<<a<<" "<<b<<endl;
		if(a==b){
			cout<<1;
		}
		else{
			cout<<0;
		}
	}
	return 0;
}