#include using namespace std; int main() { int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty; auto dist = [](int x1, int y1, int x2, int y2) { return max(abs(x1 - x2), abs(y1 - y2)); }; int ans = 2e9 + 10; if (sx == sy && tx == ty && sx > tx) { const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}; const int dy[] = {0, -1, 0, 1, 1, -1, 1, -1}; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { ans = min(ans, dist(0, 0, tx + dx[i], ty + dy[i]) + abs(dx[i] - dx[j]) + abs(dy[i] - dy[j]) + dist(tx + dx[j], ty + dy[j], sx, sy)); } } } else ans = dist(0, 0, sx, sy); cout << ans << endl; }