#include <bits/stdc++.h>
using namespace std;
const int maxn = 25;
int dx[12] = {1, -1, 2, -2, 1, -1, 2, -2, 2, -2, -2, 2};
int dy[12] = {2, 2, 1, 1, -2, -2, -1, -1, 2, 2, -2, -2};
int x3, y3, x2, y2;
bool chess[maxn][maxn];
struct ss {
int x, y, cnt;
};
queue<ss> q;
void Read() {
cin >> x3 >> y3;
cin >> x2 >> y2;
}
int bfs(int x, int y, int cnt) {
ss s;
s.x = x;
s.y = y;
s.cnt = cnt;
chess[x][y] = 1;
q.push(s);
while (!q.empty()) {
ss now = q.front();
q.pop();
if (now.x == 1 && now.y == 1)
return now.cnt;
for (int i = 0; i < 12; ++i) {
int tx = now.x + dx[i];
int ty = now.y + dy[i];
ss k;
k.x = tx;
k.y = ty;
k.cnt = now.cnt + 1;
if (tx <= 0 || ty <= 0)continue;
if (chess[tx][ty])continue;
chess[tx][ty] = 1;
q.push(k);
}
}
}
void Solve() {
Read();
cout << bfs(x3, y3, 0) << endl;
while (!q.empty()) {
q.pop();
}
for (int i = 1; i <= maxn; ++i) {
for (int j = 1; j <= maxn; ++j) {
chess[i][j] = 0;
}
}
cout << bfs(x2, y2, 0) << endl;
}
int main() {
Solve();
exit(0);
}