#include<bits/stdc++.h>
using namespace std;
int main()
{
  long int a,b,x,y;
  cin >> a >> b >> x >> y;
  int s=0;
  if (b==y || a==x)
  {
    s=2;
  }
  else if (b-y==a-x || b-y==x-a)
  {
    s=1;
  }
  cout << s;
  return 0;
}