#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
int arr[50][50];
int ddd[1050][1050];
struct node
{
int x, y;
int times;
}d1, d2;
queue<node>q;
int j[12][2] = { {2,1}, {2,-1} ,{1,2}, {1,-2}, {-2,1} ,{-2,-1} ,{-1,2} ,{-1,-2} ,{2,2}, {2,-2} ,{-2,2}, {-2,-2} };
int bfs(int x, int y)
{
while (!q.empty())
{
node d2;
d2 = q.front();
q.pop();
for (int i = 0; i < 12; i++)
{
node d3;
d3.x = d2.x + j[i][0];
d3.y = d2.y + j[i][1];
if (d3.x > 0 && d3.x <= 20 && d3.y > 0 && d3.y <= 20 && ddd[d3.x][d3.y] == 0)
{
d3.times = d2.times + 1;
if (d3.x == 1 && d3.y == 1 && ddd[d3.x][d3.y] == 0)
{
return d3.times;
}
else
{
ddd[d3.x][d3.y] == 1;
q.push(d3);
}
}
}
}
}
int main()
{
int a, b, c, d;
cin >> a >> b >> c >> d;
ddd[a][b] = 1;
d1.x = a;
d1.y = b;
d1.times = 0;
q.push(d1);
cout << bfs(a, b) << endl;
memset(ddd, 0, sizeof(ddd));
ddd[c][d] = 1;
while (!q.empty()) q.pop();
cout << bfs(c, d);
return 0;
}