#include <bits/stdc++.h>
using namespace std;

int main(){
	
	int x1,y1,x2,y2,s1,s2;
	cin>>x1>>y1>>x2>>y2;
	int n = 18 * 4;//一圈总步数
	
	//如果是上下两条线
	if(abs(x1 - x2) == 18){
		//从左侧走
		s1 = y1 - 1 + 18 + y2 - 1;  
		s2 = n - s1; // 从右侧走
	} else if(abs(y1 - y2) == 18){
		//从下面走
		s1 = x1 - 1 + 18 + x2 - 1;
		s2 = n - s1; //从上面走
		//在一条线上
	} else if(x1 == x2){
		s1 = abs(y1 - y2);//只能是这样解
		s2 = n - s1;
	}else if(y1 == y2){
		s1 = abs(x1 - x2);
		s2 = n - s1;
	}else{ //在相邻的边
		s1 = abs(x1 - x2)  + abs(y1 - y2);
		s2 = n - s1;
	}
	
	//输出更短的路径
	if(s1 < s2){
		cout<<s1;
	}  else{
		cout<<s2;
	}
	
}

/**************************************************************
	Problem: 1533
	User: admin
	Language: C++
	Result: Accepted
	Time:55 ms
	Memory:2072 kb
****************************************************************/