#include<iostream>
#include<string.h>
using namespace std;
struct node
{
int x;//点的坐标
int y;
int s;//记录步数
};
int main()
{
int startx,starty;
int endx,endy;
int tx,ty;
int n,m;
int k;
node que[300000];
int book[500][500];
int head,tail;
int next[8][2]={{-1,2},{1,2},{2,1},{2,-1},{1,-2},{-1,-2},{-2,-1},{-2,1}};
//方向
while(cin>>startx>>starty>>endx>>endy)
{
if(startx==endx&&starty==endy)
{
cout<<"0"<<endl;
}
else
{
int flag=0;
memset(book,0,sizeof(book));//初始全未被标记过
head=1;
tail=1;
//起止点入队列
que[tail].x=startx;
que[tail].y=starty;
que[tail].s=0;
book[startx][starty]=1;
tail++;
//BFS
while(head<tail)
{
for(k=0;k<8;k++)//遍历8个方向
{
tx=que[head].x+next[k][0];
ty=que[head].y+next[k][1];
//是否超出范围
if(tx<0||tx>300||ty<0||ty>300)
{
continue;
}
//未被访问过
if(book[tx][ty]==0)
{
book[tx][ty]=1;
//入队列
que[tail].x=tx;
que[tail].y=ty;
que[tail].s=que[head].s+1;
tail++;
if(tx==endx&&ty==endy)//到达访问的点结束
{
flag=1;
break;
}
}
}
if(flag==1)
{
break;//结束循环
}
head++;
}
cout<<que[tail-1].s<<endl;
}
}
}