#include <iostream>
using namespace std;
int main()
{
    int x1,y1,x2,y2,s;
    cin>>x1>>y1>>x2>>y2;
    if(abs(x1-x2)!=abs(y1-y2))
          s=0;
    else if((x1!=x2)||(y1!=y2))
          s=1;
    else if ((x1==x2)||(y1==y2))
          s=2;
    cout<<s;
}