#include <iostream>
#include <stdlib.h>
using namespace std;
int main(){

int x1, x2, y1, y2, a, b;
cin>>x1>>x2;
cin>>y1>>y2;

if(x1==x2 || y1==y2)
{
  cout<<2;
}
else{

  a=abs(x1-x2);
  b=abs(y1-y2);
  if(a==b)
  {
    cout<<1;
   }
  else
  {
    cout<<0;
  }
}

}