#include <iostream>
using namespace std;
int main()
{
int x1,y1,x2,y2,a,b,w;
while(cin>>x1>>y1>>x2>>y2,x1>0||y1>0||x2>0||y2>0)
{
if(x1>x2)a=x1-x2;
else if(x1<x2)a=x2-x1;
else a=0;
if(y1>y2)b=y1-y2;
else if(y1<y2)b=y2-y1;
else b=0;
if(a==b&&a&&b)w=1;
else if(a!=b&&a==0&& b)w=1;
else if(a!=b&&a&&b==0)w=1;
else if(a!=b)w=2;
else if(a==b&&a==0&&b==0)w=0;
cout<<w<<endl;
}
}