#include <bits/stdc++.h>
using namespace std;

long long x,y,x2,y2;

int main(){

   long long resenje=0;
   cin>>x>>y>>x2>>y2;
    if(abs(x-x2)==abs(y-y2))resenje=1;
    else if(x==x2 or y==y2) resenje=2;
    else resenje=0;

   cout<<resenje<<endl;

  return 0;
}