/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>
#include<cassert>   // assert

using namespace std;

//#define double long double

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
long long mod = 1000000007LL;
long long base = 10000007;
long long large = 1000000000000000000LL;

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int ans = 2*abs(a-c)+2*abs(b-d)+4;
	if(a==c||b==d) ans+=2;
	cout<<ans<<endl;

	return 0;

}

#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>

using namespace std;

int main(){
    int x,y,x1,y1,x2,y2,sum=0;
    cin >> x >> y >> x1 >> y1;
    if(x1 >= x)
        x2=x1+1;
    else
        x2 = x1-1;
    if(y1 >= y)
        y2 = y1+1;
    else
        y2 = y1-1;

    sum = abs(x2-x) + abs(y2-y);
    sum=sum*2;
    if(x == x1 ||y == y1)
        sum+=2;

    cout <<sum;

}

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int x1,y1,x2,y2;
	cin >> x1 >> y1;
	cin >> x2 >> y2;

	int result;
	if(x1==x2 || y1==y2)
	{
		if(x1==x2) result = 2*(abs(y1-y2)+1) + 4;
		else result =  2*(abs(x1-x2)+1) + 4;
	}
	else
	{
		if(x2>x1 && y2>y1)
		{
			x2++;
			y2++;
		}
		else if(x2<x1 && y2>y1)
		{
			x2--;
			y2++;
		}
		else if(x2<x1 && y2<y1)
		{
			x2--;
			y2--;
		}
		else if(x2>x1 && y2<y1)
		{
			x2++;
			y2--;
		}
		result = abs(2*(x2-x1)) + abs(2*(y2-y1));
	}
	if(result<0) result *= -1;
	cout << result << endl;
}

#include<bits/stdc++.h>
#define  e exit(0)
#define vi vector<int>
#define vl vector<long long>
#define vpair vector<pair<int,int>>
#define pb push_back
#define ull unsigned long long
#define um unordered_map<long long,int>
#define ums unordered_map<char,int>
#define um1 unordered_map<string,string>
#define um2 unordered_map<pair<int,int>,int>
#define ff first
#define ss second
#define ll long long
#define setbits __builtin_popcount()
#define srt sort(arr.begin(),arr.end())

using namespace std;
bool comp(string a,string b)
{
    return a.length()<b.length();
}
bool isPrime(ull n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ull i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main()
{
   int t=1;
   //cin>>t;
   while(t--)
   {
       int x1,y1,x2,y2;
       cin>>x1>>y1>>x2>>y2;
       if(y1==y2)
       {
           int ans=1+1+1+1+(abs(x2-x1)+1)*2;
           cout<<ans<<endl;
       }
       else if(x1==x2)
       {
           int ans=4+  ((abs(y1-y2))+1)*2;
           cout<<ans<<endl;
       }
       else
       {
           int ans=(abs(x1-x2)+1)*2 + (abs(y1-y2)+1)*2;
           cout<<ans<<endl;
       }

   }

}

#include <stdio.h>
#include <math.h>

int main(){
	int a,b,x,y;
	scanf("%d%d%d%d",&a,&b,&x,&y);
	if(a==x) printf("%d\n",6+2*abs(b-y));
	if(b==y) printf("%d\n",6+2*abs(a-x));
	if(a!=x&&b!=y) printf("%d\n",4+2*(abs(b-y)+abs(a-x)));
}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
	int x1, y1, x2, y2;
	cin>>x1>>y1>>x2>>y2;

	if(x1==x2){
		int xtemp=x1+1;
		int ytemp=y1;
		double l=sqrt((xtemp-x1)*(xtemp-x1)+(ytemp-y1)*(ytemp-y1));
		l=l*6;
		double l2=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		l2=l2*2;
		cout<<l+l2;return 0;
	}
	else if(y1==y2){
		int xtemp=x1;
		int ytemp=y1+1;
		double l=sqrt((xtemp-x1)*(xtemp-x1)+(ytemp-y1)*(ytemp-y1));
		l=l*6;
		double l2=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		l2=l2*2;
		cout<<l+l2;return 0;

	}
	int xTemp = x2, yTemp = y2;
	if(x2>x1){
		xTemp++;
	}
	else{
		xTemp--;
	}
	if(y2>y1){
		yTemp++;
	}
	else {
		yTemp--;
	}

	double l1 = sqrt((xTemp-x1)*(xTemp-x1));
	double l2 = sqrt((yTemp-y1)*(yTemp-y1));
	cout<<2*(l1+l2);

	return 0;
}

/*author : Yashvardhan
Wednesday, 2 September 2020
12:39 PM, IST
*/

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

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;}
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;}
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();

	int x1, y1;
	cin >> x1 >> y1;

	int x2, y2;
	cin >> x2 >> y2;

	int ans = (abs(x1 - x2) + 1) * 2 + (abs(y1 - y2) + 1) * 2;

	if (x1 == x2 || y1 == y2) ans += 2;

	cout << ans << endl;

	t2 = clock();
	cerr << endl << t2 - t1 << endl;

	return 0;
}

/*
ID: 13581551
PROG: a
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;

int main()
{
//	freopen(".out","w",stdout);
	int i,j,k,l,n,m;
	cin>>n>>m;
    cin>>k>>l;
    if(n!=k&&m!=l) {
    	if(n<k) k++;
   		else k--;
    	if(m<l) l++;
    	else l--;
    	cout<<2*(abs(n-k)+abs(m-l))<<endl;
    	return 0;
    }
    if(n==k)
    {
    	cout<<4+2*(abs(m-l)+1)<<endl;
    }
    else
    {
    	cout<<4+2*(abs(n-k)+1)<<endl;
    }
	return 0;
}

#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
    //cout <<"Enter the starting point "<<endl;
    int x1,y1,x2,y2;
    cin >> x1>>y1>>x2>>y2;
    int d=2*(abs(x2-x1)+abs(y2-y1));
    if(x1==x2||y1==y2)
    cout << d+6<<endl;
    else
        cout <<d+4<<endl;
    return 0;

}

#include <cstdio>
#include <algorithm>

#define Rep(i, _begin, _end) for(int i=(_begin),i##_END=(_end);i<=(i##_END);++i)
#define For(i, _begin, _end) for(int i=(_begin),i##_END=(_end);i!=(i##_END);++i)
#define Lop(i, _begin, _end) for(int i=(_begin),i##_END=(_end);i>=(i##_END);--i)
#define Dnt(i, _begin, _end) for(int i=(_begin),i##_END=(_end);i!=(i##_END);--i)

using std :: max;
using std :: min;

int n, m, x, y, z, k, num;
int u1, u2, v1, v2;

int main(){
	scanf("%d%d%d%d", &u1, &v1, &u2, &v2);
	if(u1 == u2){
		printf("%d\n", 2 * (abs(v1 - v2) - 1) + 8);
		return 0;
	}
	if(v1 == v2){
		printf("%d\n", 2 * (abs(u1 - u2) - 1) + 8);
		return 0;
	}
	else{
		printf("%d\n", 2 * (abs(u1 - u2) + abs(v1 - v2) + 2));
		return 0;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
const int MAX = 205;
int graph[MAX][MAX];
int visited[MAX][MAX];
int len[MAX][MAX];
bool check(int x, int y)
{
	if (x >= 0 && x < MAX && y >= 0 && y < MAX)
		return true;
	return false;
}
int bfs(int x1, int y1, int end_x, int end_y)
{
	queue<pair<int, int>> q;
	q.push({x1, y1});
	int counter = 0;
	visited[x1][y1] = 1;
	len[x1][y1] = 0;
	while (!q.empty())
	{
		auto next = q.front();
		q.pop();
		if (next.first == end_x && next.second == end_y)
		{
			counter = len[end_x][end_y];
			break;
		}
		else if (graph[next.first][next.second]!=1)
		{
			vector<pair<int, int>> arr = { {1,0},{0,1},{-1,0},{0,-1} };
			for (auto elem : arr)
			{
				pair<int, int> p ({ next.first + elem.first, next.second + elem.second });
				if (check(p.first, p.second) && visited[p.first][p.second] != 1)
				{
					visited[p.first][p.second] = 1;
					q.push(p);
					len[p.first][p.second] = len[next.first][next.second]+1;
				}
			}
		}
	}
	return counter;
}
int main()
{
	memset(graph, 0, sizeof(graph));
	memset(visited, 0, sizeof(visited));
	memset(len, 0, sizeof(len));
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	x1 += 102;
	x2 += 102;
	y1 += 102;
	y2 += 102;
	graph[x2][y2] = 1;
	int add_x = 0;
	int add_y = 0;
	if (x2 > x1)
		add_x = 1;
	if (x2 < x1)
		add_x = -1;
	if (y2 < y1)
		add_y = -1;
	if (y2 > y1)
		add_y = 1;
	cout<<2*bfs(x1, y1, x2+add_x, y2+add_y)<<endl;
	//int diff_x = abs(x1 - (x2 + add_x));
	//int diff_y = abs(y1 - (y2 + add_y));
	//cout << 2 * ( diff_x + diff_y);
}

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

int main() {
	int  x , y ;
	cin >> x >> y ;
	int a ,b ;
	cin>> a >> b ;
	if ( a == x )
		x ++ ;
	if ( b == y )
		y++ ;

	int k = abs( x - a  ) + abs( y - b   ) + 2  ;
	cout << k * 2 << endl ;

	return 0;
}

#include<iostream>
using namespace std;
int x,x2,y,y2,a;
int main()
{
    cin>>x>>y>>x2>>y2;
    if(abs(x-x2)==0||abs(y-y2)==0)
    a++;
    cout<<((abs(x-x2)+abs(y-y2)+a)*2)+4<<endl;
 //   system("pause");
}

#include <bits/stdc++.h>

#define pb push_back
#define db double
#define int long long
#define all(c) (c).begin(), (c).end()
using namespace std;

const int N = 1e6 + 1;
const int mod = 1e9 + 7;
typedef pair<int, int> pii;

inline int read () {
    char c = getchar();
    int t = 0, f = 1;
    while (!isdigit(c)) f = (c == '-') ? -1 : 1, c = getchar();
    while (isdigit(c)) t = t * 10 + c - 48, c = getchar();
    return t * f;
}

main() {
    int x1 = read(), y1 = read(), x2 = read(), y2 = read();
    int t = max(abs(x1-x2), 1ll) + max(abs(y1-y2), 1ll) + 2;
    cout << 2*t;
}

#include <iostream>
#include <cmath>        // std::abs
using namespace std;

int main() {
  int x1,y1, x2, y2 = 0;
  // get input
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  if (x2==x1){
    x2+=2;
  }else if(x2>x1){
    x2+=1;
  }else{
    x2-=1;
  }
  if (y2==y1){
    y2+=2;
  }else if (y2>y1){
    y2+=1;
  }else{
    y2-=1;
  }

  cout << 2*(abs(x1-x2)+abs(y1-y2)) << endl;
}

///In the name of Almighty Allah(swt)

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lop(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define smile ios_base::sync_with_stdio(false);	cin.tie(NULL);
int ar[9];
int main()
{
	smile
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int dx=0, dy=0;
	if (x1 == x2)
		dx = 1;
	else
		dx = abs(x2 - x1);

	if (y1 == y2)
		dy = 1;
	else
		dy = abs(y2 - y1);

	int ans =4;
	ans += 2*dy+2*dx;
	cout<<ans<<endl;

	return 0;
}

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1;
	cin >> x2 >> y2;
	int ans = abs(x1 - x2) + 1 + abs(y1 - y2) + 1;
	ans*=2;
	if (x1 == x2) ans+=2;
	if (y2 == y1) ans+=2;
	cout << ans << endl;
	return 0;
}

#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#define LL long long
using namespace std;
const int maxn=1010;

int main()
{
  int x1,x2,y1,y2;
  while(cin>>x1>>y1>>x2>>y2)
  {
    if(x1==x2)
      x1++;
    if(y1==y2)
      y1++;
    int ans=2*(abs(x1-x2-1)+abs(y1-y2-1));
    ans=max(2*(abs(x1-x2+1)+abs(y1-y2-1)),ans);
    ans=max(2*(abs(x1-x2-1)+abs(y1-y2+1)),ans);
    ans=max(2*(abs(x1-x2+1)+abs(y1-y2+1)),ans);
    cout<<ans<<endl;
  }
  return 0;
}

#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned ll
#define ipair pair<ll, ll>
#define plb pair<ll, bool>
#define psl pair<string, ll>
#define debug(a, st, en){for(ll i = st; i <= en; i++){cout << a[i] << " "; } cout << endl;}
#define debuga(a) cout << (#a) << " = " << a << endl;
#define mp make_pair
#define pb push_back
#define is insert
#define fi first
#define se second
#define endl "\n"
#define FOR(i, a, b) for(ll i = a; i <= b; i++)
#define FORD(i, a, b) for(ll i = a; i >= b; i--)
#define EACH(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define cins(_x, a, b) {for(ll $i = a; $i <= b; $i++) cin >> _x[$i];}
#define CIND(_x, a, b) {for(ll $i = a; $i <= b; $i--) cin >> _x[$i];}
#define EPS 0.0000000001
#define fl float
#define db double
#define MOD 1000000007
#define MAX 1000007
#define y1 drttfj
#define MN 300005
#define NN 200005
#define Max MAX
#define fastIO ios::sync_with_stdio(false);

using namespace std;

ll x1, y1, x2, y2;

int main() {
    cin >> x1 >> y1 >> x2 >> y2;
    if(x1 == x2) {
        x2++;
    }
    if(y1 == y2) {
        y2++;
    }

    cout << 2*(abs(x1-x2)+1 + abs(y1-y2)+1);

    return 0;
}

#include <bits/stdc++.h>
#include <string.h>
#include<math.h>
#include<iostream>

using namespace std;
int gcd(int a, int b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
bool isPrime(long long n)
{
	long long c;
    // Corner case
    if (n <= 1)
        return false;
	c=sqrt(n);
    // Check from 2 to n-1
    for (int i = 2; i <= c; i++)
        if (n % i == 0)
            return false;

    return true;
}

const long long N=1e5+7;
int l,k,d,tr,n,m,sum,mini,maxi,a,b,c,x,y;
long long t[2*N];
set <int> vis;
vector<int> v;
string s;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>a>>b>>x>>y;
	cout<<2*(max(1,abs(a-x))+1)+2*(max(abs(b-y),1)+1);

}
/*
for(int i=0; i<n; i++){

	}
*/

#include <bits/stdc++.h>

using namespace std;

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << 2 * (max(1, abs(x1 - x2)) + max(1, abs(y1 - y2)) + 2) << '\n';
}

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <sstream>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <fstream>
#define inf 0x3f3f3f3f
#define INF 0x7ffffffffffffffffff
#define LL long long
#define llu unsigned long long
#define MAXN 1000040
using namespace std;
int x, y, xx, yy, ans;
int main(){
    cin >> x >> y >> xx >> yy;
    if(x != xx && y != yy)
        ans = 2 * (abs(x - xx) + abs(y - yy) + 2);
    else
        ans = 2 * (max(abs(x - xx),abs(y - yy)) +1 + 2);
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int x1, y1, x2, y2;

int a(int x)
{
    return (x < 0) ? -x : x;
}

int main() {
    scanf("%d %d", &x1, &y1);
    scanf("%d %d", &x2, &y2);

    int answ = 8 + max(2*(a(x2 - x1) - 1), 0) + max(2*(a(y2-y1)-1), 0);

    cout << answ;
    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    if(x1==x2||y1==y2){
        int a;
        if(x1!=x2)a=abs(x1-x2)+2;
        else a=abs(y1-y2)+2;
        cout<<2*a+2<<"\n";
        exit(0);
    }
    cout<<2*(abs(x1-x2)+abs(y1-y2)+2)<<"\r\n";
}

#include <iostream>

using namespace std;

int main() {

    int x1, y1, x2, y2, anw;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    if (x1 == x2 || y1 == y2) {
        anw = (x1 == x2 ? (abs(y1 - y2) * 2 + 6) : (abs(x1 - x2) * 2 + 6));
    } else {
        anw = abs(x1 - x2) * 2 + abs(y1 - y2) * 2 + 4;
    }
    cout << anw;
    return 0;
}

#include <bits/stdc++.h>

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int main() {
	int x1, x2, y1, y2;
	cin >> x1 >> y1;
	cin >> x2 >> y2;
	int mnx = min(x1, x2 - 1);
	int mxx = max(x1, x2 + 1);
	int mny = min(y1, y2 - 1);
	int mxy = max(y1, y2 + 1);
	cout << (mxx - mnx) * 2 + 2 * (mxy - mny) << "\n";
	return 0;
}

#include<iostream>

#include<vector>

#include<string>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>

using namespace std;
#define ll long long
struct rec{
int x1,x2,y1,y2;
};

int main(){
		int x1,y1,x2,y2;
	cin >> x1 >> y1;
	cin >> x2 >> y2;
	int s1 ,s2 ;
	s1 = max(abs(x1-x2)+1,2);
	s2 = max(abs(y1-y2)+1,2);
	cout << 2*(s1+s2) << endl;

//rec	a[4];
//
//for(int i=0;i<4;i++){
//cin>>a[i].x1>>a[i].y1>>a[i].x2>>a[i].y2;
//}
//bool isr=0;
//for(int i=0;!isr&&i<4;i++)
//	for(int j=i+1;j<4;j++)
//	{
//	if(a[i].y1==a[j].x1 &&a[i].y2==a[j].x2 )
//	{
//	if(a[i].x1!=a[j].x1 &&a[i].x2!=a[j].x2&&a[i].y2!=a[j].y2&&a[i].y1!=a[j].y1 )
//		isr=1;
//	}
//
//	}
//	if(isr)
//cout<<"yes\n";
//	else
//	cout<<"NO\n";
//
/*
	map<string ,int >m;
	int n;
	cin>>n;
	string str;
	while(n--){
	cin>>str;
	int ind=str.find("oo");
	while(ind!=-1){
	str[ind]='u';
	str.erase(str.begin()+ind+1);
	ind=str.find("oo");

	}
		 ind=str.find("kh");
	while(ind!=-1){
	str[ind]='h';
	str.erase(str.begin()+ind+1);
	ind=str.find("kh");

	}
	sort(str.begin(),str.end());
	m[str]++;
	}
	cout<<m.size()<<endl;*/
return 0;
}

#include<bits/stdc++.h>

using namespace std;
int times=0;

void solve(){
    int x,y,x2,y2;
    cin>>x>>y>>x2>>y2;
    int result = ((abs(x-x2)+(x==x2?2:1))+(abs(y-y2)+(y==y2?2:1)))*2;
    cout<<result<<endl;
}

int main(){
    int t=1;
//    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
int times=0;

void solve(){
    int x,y,x2,y2;
    cin>>x>>y>>x2>>y2;
    int result = ((abs(x-x2)+1)+(abs(y-y2)+1))*2;
    if(x==x2) result =((abs(x-x2)+2)+(abs(y-y2)+1))*2;
    if(y==y2) result =((abs(x-x2)+1)+(abs(y-y2)+2))*2;
    cout<<result<<endl;
}

int main(){
    int t=1;
//    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
	int x1, y1, x2, y2;
	scanf( "%d%d%d%d", &x1, &y1, &x2, &y2 );
	int ans = abs(x1-x2) + abs(y1-y2) + 2;
	if( x1 == x2 ) ++ans;
	if( y1 == y2 ) ++ans;
	printf( "%d\n", ans<<1 );
	return 0;
}

#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x1,y1,x2,y2;
    cin>>x1>>y1;
    cin>>x2>>y2;
    if(x1==x2 && y1!=y2)
    {
        cout<<(4+2*(abs(y1-y2)+1))<<endl;
    }
    else if(y1==y2 && x1!=x2)
        {
        cout<<(4+2*(abs(x1-x2)+1))<<endl;
        }
    else cout<<(2*(abs(x1-x2)+1)+2*(abs(y1-y2)+1))<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
typedef long long ll;

const int MAXN = 0;

int main()
{
    int x1, x2, y1, y2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;

    if (x1 == x2)
        cout << (abs(y1 - y2) + 1) * 2 + 4;
    else if (y1 == y2)
        cout << (abs(x1 - x2) + 1) * 2 + 4;
    else
        cout << (abs(x1 - x2) + abs(y1 - y2) + 2) * 2;
    return 0;
}

#include <iostream>
using namespace std;

int main() {
    int x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    int len = 0;
    if (x1 > x2) len = len + 2*(x1 - x2 + 1);
    else if (x2 > x1) len = len + 2*(x2 - x1 + 1);
    else len = len + 4;
    x1 = y1; x2 = y2;
    if (x1 > x2) len = len + 2*(x1 - x2 + 1);
    else if (x2 > x1) len = len + 2*(x2 - x1 + 1);
    else len = len + 4;
    cout<< len;
    return 0;
}

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

#define For(i,l,r) for (int i=(l);i<=(r);++i)

int a,b,c,d;

int main(){
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if (a==c)
		printf("%d\n",4+2+2*abs(b-d));
	else if (b==d)
			printf("%d\n",6+abs(a-c)*2);
			else printf("%d\n",2*abs(a-c)+2*abs(b-d)+4);
	return 0;
}

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>

using namespace std;

int xa,ya,xb,yb;
int ans;
int main()
{
	ios::sync_with_stdio(false);

	cin>>xa>>ya>>xb>>yb;
	ans=0;
	if(xa==xb && ya==yb)
	{
		cout<<10<<endl;
		return 0;
	}
	if(xa==xb)
		ans+=4;
	else if(xa<xb)
		ans+=(xb-xa+1)*2;
	else//
		ans+=(xa-xb+1)*2;

	if(ya==yb)
		ans+=4;
	else if(ya<yb)
		ans+=(yb-ya+1)*2;
	else//
		ans+=(ya-yb+1)*2;
	cout<<ans<<endl;
	return 0;
}

#include <cstdio>
#include <cmath>
using namespace std;
int main() {
	int x1, y1, x2, y2, ans;
	scanf("%d%d", &x1, &y1);
	scanf("%d%d", &x2, &y2);
	if(x1 == x2) {
		ans = abs(y1 - y2) + 1;
		ans <<= 1;
		ans += 4;
	}
	else if(y1 == y2) {
		ans = abs(x1 - x2) + 1;
		ans <<= 1;
		ans += 4;
	}
	else {
		ans = abs(x1 - x2) + 1 + abs(y1 - y2) + 1;
		ans <<= 1;
	}
	printf("%d", ans);

	return 0;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int x1, y1, x2, y2;
    while(scanf("%d%d", &x1, &y1)!=EOF)
    {
        scanf("%d%d", &x2, &y2);
        int sum=0;
        sum=2*(abs(x1-x2)+abs(y1-y2));
        if(x1==x2||y1==y2)
        {
            sum=sum+6;
        }
        else
            sum=sum+4;
        printf("%d\n", sum);
    }
    return 0;
}

// Example program
#include <iostream>
using namespace std;

int abs(int x){
 if(x>=0){
  return x;
 }
 return -1*x;
}

int main(){
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int hor = abs(x1-x2)+1;
    int ver = abs(y1-y2)+1;
    if(x1 == x2){
     hor++;
    }
    if(y1 == y2){
     ver++;
    }
    cout << 2*hor + 2*ver << endl;

}

#include <cassert>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<string>
#include<cstdlib>
#include<memory.h>
#include<ctime>
#include<bitset>
#include<fstream>
#include<queue>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include <time.h>
#include<chrono>
#include <ctime>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>

#define UI unsigned LL
#define LL long long
#define GT(it,v) for(auto it:v)
#define FU(i,a,b) for(LL i=(a);i<(b);i++)
#define FD(i,a,b) for(LL i=(a);i>(b);i--)
#define LD long double
#define PI 3.1415926535897932384626
#define PII pair<LL,LL>
#define PLL pair<LL,LL>
#define VLL vector<long long >
#define VVLL vector<vector<long long > >
#define VVVLL vector<vector<long long > >
#define VPLL vector<pair<long long, long long>>
#define VVPLL vector<vector<pair<long long, long long>>>
#define VD vector<double>
#define VVD vector<vector<double> >
#define VPD vector<pair<double,double> >
#define MP make_pair
#define PB push_back
#define FI first
#define SE second
#define SORT(v) sort(v.begin(),v.end())
#define GSORT(v,what) sort(v.begin(),v.end(),greater<what>)
#define UNIQUE(it,v) (it = unique(v.begin(),v.end()), v.resize(distance(v.begin(),it)))
using namespace std; LL inp, Inp; LL i1, i2, i3, i4, i5, i6, i7, i8;
LL MOD = 998244353, MOD1 = (LL)1e9 + 7, MOD2 = (LL)1e9 + 9; long long MOD3 = (long long)1e9 + 21 /*33*/;  double eps = 1e-9;
LL TMP = (chrono::high_resolution_clock::now().time_since_epoch().count() % MOD + MOD) % MOD;
auto STTMP = chrono::steady_clock::now();//auto ENTMP = chrono::steady_clock::now();
//ELTIME = double(chrono::duration_cast<chrono::milliseconds>(ENTMP - STTMP).count());
//time_t result = time(NULL); char SS[26]; ctime_s(SS, sizeof SS, &result);
//transform(SS, SS + 26, SS, [](char ch) {return ch == ' ' ? '_' : ch; }); prLLf("%s", SS);

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.precision(20);
	srand((unsigned LL)TMP);
	LL x1, y1; cin >> x1 >> y1;
	LL x2, y2; cin >> x2 >> y2;
	if (abs(x1 - x2) >= 1 && abs(y1 - y2) >= 1) {
		cout << 2 * (abs(x1 - x2) + 1 + abs(y1 - y2) + 1);
	}
	else {
		cout << 2*(abs(x1 - x2) + abs(y1 - y2)) + 6;
	}

	return 0;
}

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

int W[10004], cost[10004], dp[104][1004], ans[1000] ;

int NS(int i, int w, int cap, int n){
    int p1, p2 ;
    if(i > n) return 0 ;
    if(dp[i][w] != -1) return dp[i][w] ;
    if(w + W[i] <= cap){
        p1 = cost[i] + NS(i+1, w + W[i], cap, n) ;
    }
    else{
        p1 = 0 ;
    }
    p2 = NS(i+1, w, cap, n) ;
    dp[i][w] = max(p1, p2) ;
    if(w+W[i] <= cap) ans[w+W[i]] = dp[i][w] ;
    return dp[i][w] ;
}
void solve(){
    int x1, y1, x2, y2 ;
    cin>>x1>>y1>>x2>>y2 ;
   // x1 = abs(x1), x2 = abs(x2), y1 = abs(y1), y2 = abs(y2) ;

    if(x1 == x2) x1++ ;
    else if(y1 == y2) y1++ ;

    int ans1 = (abs(x1-x2) + 1 ) * 2 ;
    int ans2 = (abs(y1 - y2) + 1) * 2 ;
    int ans = abs(ans1) + abs(ans2) ;
    cout<<ans ;
}
int main(){
    solve() ;
    return 0 ;
}

#include <iostream>

using namespace std;

int abs(int a){
    if (a > 0)
        return a;
    return -a;
}

int elix, eliy, flagx, flagy;

int main()
{
    cin >> elix >> eliy;
    cin >> flagx >> flagy;

    if (elix == flagx)
        cout << (abs(eliy-flagy)+1)*2 +4;
    else if (eliy == flagy)
        cout << (abs(elix-flagx)+1)*2 +4;
    else {
        if (flagx > elix)
            flagx ++;
        else
            flagx --;

        if (flagy > eliy)
            flagy ++;
        else
            flagy --;

        cout << (abs(elix-flagx) + abs(eliy-flagy)) * 2;
    }

    return 0;
}

#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int a, b;
    int c, d;
    cin >> a >> b >> c >> d;
    int len1, len2;
    if (a != c) {
        len1 = c - a;
        len1 = abs(len1) + 1;
    } else {
        len1 = 2;
    }
    if (b != d) {
        len2 = b - d;
        len2 = abs(len2) + 1;
    } else {
        len2 = 2;
    }
    cout << (len1 + len2) * 2 << endl;
}

#include <bits/stdc++.h>

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int main(){ _

	int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;

	int ans = 2*max({2,abs(x1-(x2+1)), abs(x1-(x2-1))});
	ans += 2*max({2,abs(y1-(y2+1)), abs(y1-(y2-1))});

	cout << ans << endl;

	return 0;
}

#include<iostream>
using namespace std;
int main()
{
int x1  , x2 , y1  , y2  , squre ;
cin >> x1 >> y1 >> x2 >> y2 ;
x1+=(x2==x1); y1+=(y2==y1);
squre = (abs(x2-x1)+1)+(abs(y2-y1)+1);
cout << squre*2 << endl ;
}

#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

int main() {
	int x1, y1, x2, y2;
	scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	printf("%d\n", (max((int)labs(x1-x2), 1)+1)*2 + (max((int)labs(y1-y2), 1)+1)*2);

	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a,b,c,d;
int abs(int x)
{
	return x>0?x:-x;
}
int main()
{
	scanf("%d%d%d%d",&a,&b,&c,&d);
	a-=c,b-=d;
	a=abs(a);
	b=abs(b);
	if(!a) a++;
	if(!b) b++;
	printf("%d",2*(a+b)+4);
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

#define forn(i, n) for(long long int i = 0; i < (long long int)(n); i++)
#define ford(i, n) for(long long int i = (long long int)(n) - 1; i >= 0; i--)
#define fore(i, a, n) for(long long int i = (long long int)(a); i <(long long int)(n); i++)
#define endl '\n'
#define pb push_back
#define see(x) cout << (#x) << " is " << (x) << endl
#define mx (int)1e9
#define mn (int)-1e9
int main()
{
     int x1,y1,x2,y2;
     int x3,y3;
     int s;
     cin>>x1>>y1>>x2>>y2;
     // cout<<"hill";
     if(x2>x1 and y2>y1)
     {
          x3=x2+1;
          y3=y2+1;
          s=2*abs(x3-x1)+2*abs(y3-y1);
     }
     else if(x2>x1 and y1>y2)
     {
          y3=y2-1;
          x3=x2+1;
          s=2*abs(x3-x1)+2*abs(y3-y1);
     }
     else if(x2<x1 and y2>y1)
     {
          y3=y2+1;
          x3=x2-1;
          s=2*abs(x3-x1)+2*abs(y3-y1);
     }
     else if(x2<x1 and y2<y1)
     {
          y3=y2-1;
          x3=x2-1;
          s=2*abs(x3-x1)+2*abs(y3-y1);
     }
     else if(x2==x1)
     {
          // cout<<"hill";
          if(y2>y1)
          {
               y3=y2+1;
               s=2*abs(y3-y1)+4;
          }

          if(y1>y2)
          {
               y3=y2-1;
               s=2*abs(y3-y1)+4;
          }
     }
     else if(y2==y1)
     {
          if(x2>x1)
          {
               x3=x2+1;
               s=2*abs(x3-x1)+4;
          }

          if(x2<x1)
          {
               x3=x2-1;
               s=2*abs(x3-x1)+4;
          }
     }
     cout<<s;
}

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;

int d1,d2;

if(x1==x2 )
d1=2;

else if(x1*x2>=0)
d1=abs(abs(x1)-abs(x2) )+1;

else if(x1*x2<0)
d1=abs(abs(x1)+abs(x2) )+1;

if(y1==y2 )
d2=2;

else if(y1*y2>=0)
d2=abs(abs(y1)-abs(y2) )+1;

else if(y1*y2<0)
d2=abs(abs(y1)+abs(y2) )+1;

	cout<<2*d1+2*d2<<endl;

	return 0;
}

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

int dist(int x, int y, int p, int q) {
	return 2 * (abs(x-p) + abs(y-q)) + 8;
}
int main() {
	int p, q;
	int x, y;
	scanf("%d %d %d %d", &p, &q, &x, &y);
	int ans = INT_MAX;
	for(int i : {1, 0, -1}) {
		for(int j : {1, 0, -1}) {
			if(!i && !j) continue;
			ans = min(ans, dist(p, q, x+i, y+j));
		}
	}
	printf("%d\n", ans);
	return 0;
}

#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;

int main(){
	int x1,y1,x2,y2;
	scanf("%d%d%d%d", &x1,&y1,&x2,&y2);
	if(x1 == x2) x1++;
	if(y1 == y2) y1++;
	cout << 2 * ((abs(x1-x2) + 1) + (abs(y1-y2) + 1));
}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long a,b,x,y,r,z;
	cin>>a>>b>>x>>y;
	z=abs(a-x),r=abs(b-y);
	if(!z)
		z=1;
	if(!r)
		r=1;
	cout<<(r+z)*2+4<<endl;
	return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int x1,x2,y1,y2;
	cin>>x1>>y1>>x2>>y2;

	int res = (2*( abs(x1-x2)+1 ))+ (2*(abs(y1-y2) +1) );
	if(x1 == x2)
		res+=2;
	if(y1 == y2)
		res+=2;

	cout<<res<<endl;

	return 0;
}

/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed() ios::sync_with_stdio(0);cin.tie(0);
#define file() freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define rep(i,b,e) for(__typeof(e) i=(b)-(b>e);i!=(e)-(b>e);i+=1-2*(b>e))
#define trace(x) cerr << #x << " = " << x << endl
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define rall(v)   v.rbegin(),v.rend()
#define sl(a)   scanf("%lld",&a)
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define pi acos(-1)
#define en '\n'
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>mi;
typedef pair<ll,ll>pll;
typedef vector<pll> vll;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] = {-1,+1,0,0,+1,-1,+1,-1};
ll dy[] = {0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;

template <class T> T power(T a,T b){a%=MOD;if(!a) return 0;T p=1;while(b>0){if(b&1){p*=a;p%=MOD;}a*=a;a%=MOD;b=b>>1;}return p;}
template <class T> void print(vector<T> &v){for(T u:v){cout<<u<<" ";}cout<<endl;}
template <class T> T gcd(T a, T b){return (b!=0?gcd<T>(b,a%b):a);}
template <class T> T lcm(T a, T b){return (a/gcd<T>(a,b)*b);}

int main()
{
    speed();
    ll x1,x2,y1,y2,ans1=0,ans2=0;
    cin>>x1>>y1;
    cin>>x2>>y2;
    if(x1<0 && x2>0)
        ans1 = (x2-x1);
    else if(x2<0 && x1>0)
        ans1 = (x1-x2);
    else
        ans1 = abs(x1-x2);
    if(x1==x2)
    {
        ans1 = (ans1+1)*4;
    }
    else
    {
        ans1 = (ans1+1)*2;
    }
    if(y1<0 && y2>0)
        ans2 = (y2-y1);
    else if(y2<0 && y1>0)
        ans2 = (y1-y2);
    else
        ans2 = abs(y1-y2);
    if(y1==y2)
    {
        ans2 = (ans2+1)*4;
    }
    else
    {
        ans2 = (ans2+1)*2;
    }
    cout<<(ans1+ans2)<<endl;

return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define  fr(i,a)  for(i=0;i<a;i++)
#define  tc(i,t)  for(i=1;i<=t;i++)
#define  cln(x)   memset(x,0,sizeof(x))
#define  clr(x)   memset(x,-1,sizeof(x))
#define  read()   freopen("input.txt","r",stdin)
#define  write()  freopen("output.txt","w",stdout)
main()
{
    int x,y,x1,y1,x2,y2;
    while(cin>>x1>>y1>>x2>>y2)
    {
        if(x1>=x2)  x=(x1-x2+1)*2;
        else        x=(x2-x1+1)*2;
        if(y1>=y2)  y=(y1-y2+1)*2;
        else        y=(y2-y1+1)*2;
        if(x1==x2)  x+=2;
        if(y1==y2)  y+=2;
        cout<<max(8,x+y)<<endl;
    }
    return 0;
}

#include<iostream>
#include<cmath>

using namespace std;

int main()
{
	int x1,y1,x2,y2, xdist, ydist;
	cin >> x1>>y1>>x2>>y2;
	xdist = abs( x1- x2 )+1;

	ydist = abs( y1 - y2 )+1;

	if(x1==x2) xdist = 2;
    if(y1 == y2) ydist = 2;
    int length = 2*(xdist+ydist);
    cout << length;
return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int ans = 2 * (abs(x1 - x2) + 1) + 2 * (abs(y1 - y2) + 1);
    if(x1 == x2)ans += 2;
    if(y1 == y2)ans += 2;
    cout << ans << '\n';
    return 0;
}

#include <bits/stdc++.h>
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
#define forn(i, a, b) for (int i = a; i < b; i++)
#define l_b(v, a) lower_bound(v.begin(), v.end(), a)
#define u_b(v, a) upper_bound(v.begin(), v.end(), a)
using namespace std;

typedef long long lli;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef double d;
const int oo = (1<<30);

int main() {
  int x1, x2, y1, y2;
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  int ans1 = abs(x1 - x2) + abs(y1 - y2) + 6;
  x1 -= x2;
  y1 -= y2;
  int dx, dy;
  if (x1 >= 0 && y1 >= 0)
    dx = 1, dy = 1;
  if (x1 <= 0 && y1 >= 0)
    dx = -1, dy = 1;
  if (x1 <= 0 && y1 <= 0)
    dx = -1, dy = -1;
  if (x1 >= 0 && y1 <= 0)
    dx = 1, dy = -1;
  int ans2 = abs(x1 - dx) + abs(y1 - dy);
  cout << ans1 + ans2 << '\n';

  return 0;
}

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

void solve() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2 and y1 != y2) {
        cout << 6 + 2 * abs(y2 - y1);
        return;
    }
    if (y1 == y2 and x1 != x2) {
        cout << 2 * (abs(x2 - x1) + 1) + 4;
        return;
    }
    cout << 2*(abs(x2 - x1) + 2 + abs(y2 - y1));
}

signed main() {
    #ifdef _DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();

    #ifdef _DEBUG
        cout << "\n\nproc time: " << 1.0 * clock() / CLOCKS_PER_SEC << "s    ";
    #endif

}

#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	if(x1==x2||y1==y2)
		cout<<2*(abs(x1-x2)+abs(y1-y2)+3)<<endl;
	else
		cout<<2*(abs(x1-x2)+abs(y1-y2)+2)<<endl;
	return 0;
}

#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<sstream>
#include<deque>
#include<math.h>
#include<cstring>
#include <bitset>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>

#define all(v) v.begin(),v.end()
#define mpair make_pair

using namespace std;
typedef long double ld;
const ld epsilon = 1e-9;
typedef long long ll;

int main()
{
	//freopen("bobi.in", "r", stdin);
	int x, y, x1, y1;
	cin >> x >> y >> x1 >> y1;
	int res = (abs(x - x1) + 1) * 2 + (abs(y - y1) + 1) * 2;
	if (x == x1 || y == y1) res += 2;
	cout << res << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a,b,c,d; cin >>a>>b>>c>>d;
    if (a != c && b != d) {
        cout << (abs(a-c) + abs(b-d) + 2) * 2 << endl;
    } else {
        if (a == c) {
            cout << (2 + abs(b-d) + 1) * 2 << endl;
        } else {
            cout << (2 + abs(a-c) + 1) * 2 << endl;
        }
    }
}

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

int main()
{
    int a,b,x,y;
    scanf("%d%d%d%d",&a,&b,&x,&y);
    if((a-x)*(a-x)+(b-y)*(b-y)<=2){
        printf("8\n");
        return 0;
    }
    int ans;
    if(a>x)ans=abs(a-x+1)*2+abs(b-y+1)+abs(b-y-1)+2;
    else if(a<x)ans=abs(a-x-1)*2+abs(b-y+1)+abs(b-y-1)+2;
    else {
        if(b>y)ans=abs(b-y+1)*2+abs(a-x+1)+abs(a-x-1)+2;
        else ans=abs(b-y-1)*2+abs(a-x+1)+abs(a-x-1)+2;
    }
    printf("%d\n",ans);
    return 0;
}

/* code by AbhiTaker  */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x,y,x2,y2;
    cin>>x>>y>>x2>>y2;
    ll l,b;
    if(x==x2)
        l=2;
    else
        l = abs(x - x2) + 1;

    if(y==y2)
        b = 2;
    else
        b = abs(y-y2)+1;

    ll ans = 2*l + 2*b;
    cout<<ans<<"\n";

    return 0;

}

#include <bits/stdc++.h>

#define INF 1e9+7
#define pf2 pop_front
#define pb2 pop_back
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz size
#define eps 1e-7
#define fod find_by_order
#define fastio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ofk order_of_key
#define val(x) cout << "Value dari "<< #x << " adalah " << x  << "\n"
#define tr tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
using namespace std;

int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};

void readf(string x){
	freopen((x+".in").c_str(),"r",stdin);
	freopen((x+".out").c_str(),"w",stdout);
}

void pr(string x){
	freopen((x+".in").c_str(),"w",stdout);
}

int read()
{
	bool min = 0;
	int  result = 0;
	char ch;
	ch = getchar();
	while(1)
	{
		if(ch == '-') break;
		if(ch >='0' && ch <= '9') break;
		ch = getchar();
	}
	if(ch == '-') min = 1;else result = ch-'0';
	while(1)
	{
		ch =getchar();
		if(ch< '0' || ch>'9') break;
		result = result * 10 + (ch-'0');
	}
	if(min) return -result;
	return result;
}
//Reynaldo's Template

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if(c == a) {
		c++;
	}
	if(b == d) {
		d++;
	}
	int x[4],y[4];
	x[0] = c+1; y[0] = d+1;
	x[1] = c+1; y[1] = d-1;
	x[2] = c-1; y[2] = d+1;
	x[3] = c-1; y[3] = d-1;
	int ans = 0;
	ll maks = 0;
	for(int i=0;i<4;i++){
		ans = ans + abs(x[i] - a) + abs(y[i] -b);
		maks = max(maks,(ll)abs(x[i] - a) + abs(y[i]-b) );
	//	a = x[i]; b = y[i];
	}
	cout << 2*maks<< "\n";
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int x,y;
int xx,yy;

long long read()
{
	long long x=0,f=1;char c=getchar();
	while (!isdigit(c)) {if (c=='-')f=-1;c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0';c=getchar();}
	return x*f;
}

void write(long long x)
{
	if (x<0) putchar('-'),x=-x;if (x>=10) write(x/10);
	putchar(x%10+'0');
}

void writern(long long x)
{
	write(x),putchar(' ');
}

void writeln(long long x)
{
	 write(x),puts("");
}

int abs(int x)
{
	return x>=0?x:-x;
}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	x=read(),y=read(),xx=read(),yy=read();
	int ans=2e9;
	if (x==xx)
	{
		ans=abs(y-yy)*2+6;
	}
	else if (x<xx)
	{
		if (y==yy)
		{
			ans=(xx-x)*2+6;
		}
		else if (y<yy)
		{
			int tx=xx+1,ty=yy+1;
			int ttx=xx+1,tty=yy-1;
			ans=min(ans,tx-x+ttx-x+ty-y+tty-y+2);
			ttx=xx-1,tty=yy+1;
			ans=min(ans,tx-x+ttx-x+ty-y+tty-y+2);
		}
		else
		{
			int tx=xx+1,ty=yy+1;
			int ttx=xx+1,tty=yy-1;
			ans=min(ans,tx-x+ttx-x+y-ty+y-tty+2);
			tx=xx-1,ty=yy-1;
			ans=min(ans,tx-x+ttx-x+y-ty+y-tty+2);
		}
	}
	else
	{
		if (y==yy)
		{
			ans=(x-xx)*2+6;
		}
		else if (y<yy)
		{
			int tx=xx-1,ty=yy+1;
			int ttx=xx-1,tty=yy-1;
			ans=min(ans,x-tx+x-ttx+ty-y+tty-y+2);
			ttx=xx+1,tty=yy+1;
			ans=min(ans,x-tx+x-ttx+ty-y+tty-y+2);
		}
		else
		{
			int tx=xx-1,ty=yy-1;
			int ttx=xx+1,tty=yy-1;
			ans=min(ans,x-tx+x-ttx+y-ty+y-tty+2);
			ttx=xx-1,tty=yy+1;
			ans=min(ans,x-tx+x-ttx+y-ty+y-tty+2);
		}
	}
	writeln(ans);
	return 0;
}

/*
教练我想打ACM！
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

const int inf = 0x3f3f3f3f;
const int maxn = 100000 + 20;

int X[8], Y[8];
const int dx[] = {-1, 1, 0, 0, -1, 1, 1, -1};
const int dy[] = {0, 0, -1, 1, -1, -1, 1, 1};
int manhattan(int x, int y, int x0, int y0) {
  return abs(x - x0) + abs(y - y0);
}
int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  for (int i = 0; i < 8; ++i) {
    X[i] = x2 + dx[i];
    Y[i] = y2 + dy[i];
  }
  int d = inf;
  for (int i = 0; i < 8; ++i) {
    d = min(d, manhattan(x1, y1, X[i], Y[i]));
  }
  cout << d * 2 + 8 << '\n';
  return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define N 1000005
#define For(i,x,y) for(int i=x;i<=y;i++)
#define Rep(i,x,y) for(int i=x;i>=y;i--)
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;
	return f?-x:x;
}
int x,y,xx,yy;
int main(){
	x=read();y=read();xx=read();yy=read();
	if(x==xx){
		cout<<4+abs(y-yy)*2+2;
		return 0;
	}
	if(y==yy){
		cout<<4+abs(x-xx)*2+2;
		return 0;
	}
	cout<<2*(abs(x-xx)+abs(y-yy))+4;
	return 0;
}

#include <iostream>
#include<ostream>
#include <vector>
#include <cmath>
#include<string>
#include<map>
#include<set>
using namespace std;
int main()
{
int a,b,c,d,re,re1;
cin>>a>>b>>c>>d;
re=(abs(a-c)+1)*2;
re1=(abs(b-d)+1)*2;
if(a==c)re+=2;
if(b==d)re1+=2;
cout<<re+re1<<endl;

return 0;
}

#include<iostream>
#include<cmath>
using namespace std;

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	double distance = sqrt(pow((x1-x2), 2) + pow((y1-y2),2));
	if (distance == 1 || distance == sqrt(2)) {
		cout << 8 << endl;
		return 0;
	}
	int xdiff = abs(x1 - x2);
	int ydiff = abs(y1 - y2);
	int result = xdiff + 1 + ydiff + 1 + 2 + 2 + abs(xdiff - 1) + abs(ydiff - 1);
	cout << result << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	int a=2*(abs(x1-x2)+abs(y1-y2)+2);
	if(x1==x2||y1==y2)
	    a+=2;
	cout<<a<<endl;
	return 0;
}

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

int main()
{
    int x1, x2, y1, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    if (x1 == x2)
        printf("%d\n", 2 * (abs(y1 - y2) + 3));
    else if (y1 == y2)
        printf("%d\n", 2 * (abs(x1 - x2) + 3));
    else
        printf("%d\n", 2 * (abs(x1 - x2) + abs(y1 - y2) + 2));
    return 0;
}

/*
 * author: rishi_mohan
 * created_at: Fri 09 Oct 2020 07:43 PM
 */

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

void solve()
{
	int x1, y1, x2, y2, ans=0;
	cin >> x1 >> y1 >> x2 >> y2;
	ans = 2*(abs(x1-x2)+1)+2*(abs(y1-y2)+1);
	if(x1==x2 || y1==y2) ans+=2;
	cout << ans << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
}

#include <iostream>
#include<cmath>
using namespace std;

int main() {
int x1 ,x2, y1,y2;
cin>>x1>>y1>>x2>>y2;
int l =0 ;
l = abs(x1-x2) + abs(y1-y2) + 2;
if(x1==x2) l++ ;
if(y1==y2) l++;
cout<<l*2 ;
	// your code goes here
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int x,y,a,b;
int min_distance(){
    cin>>x>>y>>a>>b;
    if(x==a||y==b)return 2*abs(x-a+y-b)+6;
    return 2*abs(x-a)+2*abs(y-b)+4;
}
int main(){
    cout<<min_distance();
}

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

int a,b,c,d;

int main(){
    scanf("%d%d%d%d", &a,&b,&c,&d);
    int l = abs(a-c)+1, r = abs(b-d)+1;
    printf("%d\n", 2*(max(l,2) + max(r,2)));
    return 0;
}

#include <iostream>
#include<cmath>
using namespace std;

int main()
{
    long long a,b,c,d;
    long long p=0;
    cin>>a>>b>>c>>d;
    if(a!=c){
        p=p+((abs(a-c)+1)*2);
    }
    if(b!=d){
        p=p+((abs(b-d)+1)*2);
    }
    if(a==c){
        p=p+4;
    }
    if(b==d){
        p=p+4;
    }
    cout<<p;
    return 0;
}

#include <iostream>

using namespace std;

int coords[4];
int n,a,b;
//coords[0],coords[1] = copter(x,y)
//coords[2],coords[3] = flag(x,y)
int main() {
    cin >> coords[0] >> coords[1] >> coords[2] >> coords[3];
    a = coords[0] - coords[2];
    if ((a / 1) < 0) {
        a *= -1;
    }
    b = coords[1] - coords[3];
    if ((b / 1) < 0) {
        b *= -1;
    }
    if (coords[0] == coords[2] || coords[1] == coords[3]) {
        n = 2 * a + 2 * b + 6;
    }
    else {
        n = 2 * a + 2 * b + 4;
    }
    cout << n;
    return 0;
}

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

int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int width = (abs(x2 - x1) + 1);
    if (width == 1) width = 2;
    int height = (abs(y2 - y1) + 1);
    if (height == 1) height = 2;
    int ans = (width + height) * 2;
    cout << ans;
    return 0;
}

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int x1, y1, x2, y2;
int main()
{
    cin >> x1 >> y1 >> x2 >> y2;
    int diff_x = abs(x1-x2);
    int diff_y = abs(y1-y2);
    if(x1 == x2 || y1 == y2) {
        ++diff_x;
    }
    ++diff_x;
    ++diff_y;
    int answer = 2*(diff_x + diff_y);
    cout << answer << endl;

    //cout << "Hello world!" << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int a1, b1, a2, b2, c1, c2;
int dis( int a, int b, int c, int d )
{
	return abs(a - c) + abs(b - d);
}
int main(){
	scanf( "%d%d%d%d", &a1, &b1, &a2, &b2 );
	if( a1 != a2 && b1 != b2 ) {
		if( a1 < a2 ) c1 = a2 + 1; else c1 = a2 - 1;
		if( b1 < b2 ) c2 = b2 + 1; else c2 = b2 - 1;
		printf( "%d\n", dis( a1, b1, c1, c2 )*2 );
	}else{
		if( a1 == a2 ) printf( "%d\n", abs( b1 - b2 )*2 + 6 );
		else printf( "%d\n", abs( a1 - a2 )*2 + 6 );
	}
	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int abs(int a, int b)
{
	if(a > b)
		return a-b;
	return b-a;
}
int main()
{
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int ret = abs(x1,x2) + abs(y1,y2) + 2;
	if(x1 == x2)
		ret ++;
	if(y1 == y2)
		ret ++;
	cout << 2*ret << endl;
}

//
//  main.cpp
//  2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred)
//
//  Created by S M HEMEL on 21/10/17.
//  Copyright © 2017 Eastern University. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cstdio>
using namespace std;
int main(){
    int x,y,x1,y1;
    cin >> x >> y >> x1 >> y1;
    x += 5;
    y += 5;
    x1 += 5;
    y1 += 5;
    long long int ans = 0;
    if(abs(x-x1)==0)
        ans += 2;
    else
        ans += abs(x-x1)+1;
    if(abs(y-y1)==0)
        ans += 2;
    else
        ans += abs(y-y1)+1;
    ans *= 2;

    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
const int INF = 1e9;
long long MOD =1e9+7;

 int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);

    int x,y,x1,y1;
    cin>>x>>y>>x1>>y1;
        if(x==x1)x++;
        if(y==y1)y++;
    cout<<(abs(y-y1)+2+abs(x-x1))*2<<endl;

       return 0;
}

#include<bits/stdc++.h>

using namespace std;
#define ll long long
/*
ll a[211111];
ll temp[111111];

ll num[511111];

void update(int rt, int l, int r, int pos, ll val){
    if(l == r){
        num[rt] = val;
        return;
    }
    int mid = (l + r) >> 1;
    if(pos <= mid) update(rt << 1, l, mid, pos, val);
    else update(rt << 1|1, mid + 1, r, pos, val);
    num[rt] = max(num[rt << 1], num[rt << 1|1]);
}

ll query(int rt, int l, int r, int L, int R){
    if(L <= l && R >= r){
        return num[rt];
    }
    int mid = (l + r) >> 1;
    ll mx = -__LONG_LONG_MAX__;
    if(mid >= L) mx = max(mx, query(rt << 1, l, mid, L, R));
    if(R > mid) mx = max(mx, query(rt << 1|1, mid + 1, r, L, R));
    num[rt] = max(num[rt << 1], num[rt << 1|1]);
    return mx;
}

int main(){
    int n;
    scanf("%d", &n);
    for(ll i = 1; i <= n; i++){
        scanf("%lld", &a[i]);
        update(1, 1, n, i, i*i + a[i] * a[i]);
    }
    ll mx = -__LONG_LONG_MAX__;
    for(ll i = 1; i < n; i++){
        mx = max(mx, query(1, 1, n, i + 1, n) - (i * i + a[i] * a[i]));
    }
    memset(num, 0, sizeof num);
    for(int i = 1; i <= n; i++){
        update(1, 1, n, i, i * i - a[i] * a[i]);
    }
    for(ll i = 1; i < n; i++){
        mx = max(mx, query(1, 1, n, i + 1, n) + (a[i] * a[i] - i * i));
    }
    printf("%lld\n", mx);
}*/

int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << ((abs(x2 - x1) + 1) * 2 + (abs(y2 - y1) + 1) * 2) + ((x1 == x2 || y1 == y2) ? 2 : 0) << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define maxn 1000000
typedef long long ll;
const double PI = acos(-1.0);
int T, n, m;
int main()
{
    std::ios::sync_with_stdio(false);
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    //cout << x2 <<endl;
    x1 += 110;
    y1 += 110;
    x2 += 110;
    y2 += 110;
    int a = max(x1, x2);
    int b = min(x1, x2);
    int c = max(y1, y2);
    int d = min(y1, y2);
    if(a - b > 1 && c - d > 1)
    {
        cout << 2 * ((abs(x1 - x2) + 1) + (abs(y1 - y2) + 1)) << endl;
    }
    else
    {
        if(a - b <= 1 && c - d <= 1)
        cout << "8" << endl;
        else
        cout << 2 * ((abs(x1 - x2) + 1) + (abs(y1 - y2) + 1)) << endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int graph[202][202];
int visited[202][202];
int len[202][202];
bool check(int x, int y)
{
	if (x >= 0 && x <= 200 && y >= 0 && y <= 200)
		return true;
	return false;
}
int bfs(int x1, int y1, int end_x, int end_y)
{
	queue<pair<int, int>> q;
	q.push({x1, y1});
	int counter = 0;
	visited[x1][y1] = 1;
	len[x1][y1] = 0;
	while (!q.empty())
	{
		auto next = q.front();
		q.pop();
		if (next.first == end_x && next.second == end_y)
		{
			counter = len[end_x][end_y];
			break;
		}
		else if (graph[next.first][next.second]!=1)
		{
			vector<pair<int, int>> arr = { {1,0},{0,1},{-1,0},{0,-1} };
			for (auto elem : arr)
			{
				pair<int, int> p ({ next.first + elem.first, next.second + elem.second });
				if (check(p.first, p.second) && visited[p.first][p.second] != 1)
				{
					visited[p.first][p.second] = 1;
					q.push(p);
					len[p.first][p.second] = len[next.first][next.second]+1;
				}
			}
		}
	}
	return counter;
}
int main()
{
	memset(graph, 0, sizeof(graph));
	memset(visited, 0, sizeof(visited));
	memset(len, 0, sizeof(len));
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	x1 += 100;
	x2 += 100;
	y1 += 100;
	y2 += 100;
	graph[x2][y2] = 1;
	int add_x = 0;
	int add_y = 0;
	if (x2 > x1)
		add_x = 1;
	if (x2 < x1)
		add_x = -1;
	if (y2 < y1)
		add_y = -1;
	if (y2 > y1)
		add_y = 1;
	cout<<2*bfs(x1, y1, x2+add_x, y2+add_y)<<endl;
	//int diff_x = abs(x1 - (x2 + add_x));
	//int diff_y = abs(y1 - (y2 + add_y));
	//cout << 2 * ( diff_x + diff_y);
}

#include<bits/stdc++.h>

using namespace std;

int main()

{
	int x1,x2,y1,y2,a,b,c,sum;
	cin>>x1>>y1>>x2>>y2;
	a=abs(x1-x2)+1;
	b=abs(y1-y2)+1;
	cout<<a<<" "<<b<<endl;
	if(a==1 & b==1)
	{
		a=2;
		b=2;
	}
	else if(a==1)
	a=2;
	else if(b==1)
	b=2;
	else
	{
		a=a;
		b=b;
	}

	c=a+b;

	sum=c*2;
	cout<<sum;

   return 0;
}

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

int main(){
    int x,y,a,b,a2,b2;
    cin>>x>>y>>a>>b;
    int ans = 0;
    if(abs(x-a) < 2 && abs(y - b) < 2){
        cout<<8; return 0;
    }
    for(int i=0; i<4; i++){
        a2 = a + ((i%2 - 1) * 2);
        b2 = b + ((i/2 - 1) * 2);
        ans = max(ans, (abs(x - a2) + abs(y - b2)) * 2);
    }
    cout<<ans;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
using namespace std;

struct Point
{
	int x;
	int y;

};

void main()
{
	Point begin, flag;
	int moves = 0;
	cin >> begin.x >> begin.y;
	cin >> flag.x >> flag.y;
	while (begin.y > flag.y + 1)
	{
		begin.y--, moves++;
	}
	while (begin.y < flag.y - 1)
	{
		begin.y++, moves++;
	}
	while (begin.x < flag.x - 1)
	{
		begin.x--, moves++;
	}
	while (begin.x > flag.x + 1)
	{
		begin.x++, moves++;
	}
	moves *= 2;
	moves += 8;
	cout << moves;

}

#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
    int x1, y1, x2, y2;
    cin>>x1>>y1>>x2>>y2;
    if(x1!=y1 && x2!=y2)
    {
        cout<<2*(abs(x2-x1)+abs(y2-y1)+2)<<endl;
    }
    else
    {
        cout<<2*(abs(x2-x1)+abs(y2-y1)+3)<<endl;
    }
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int x1,x2,y1,y2;
int main()
{
	scanf("%d%d%d%d",&x1,&x2,&y1,&y2);
	printf("%d\n",max(8,2*(abs(x2-x1)+1+abs(y2-y1)+1)));
	return 0;
}

#include<iostream>
#include<cmath>
using namespace std;

int main()
{
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a1 = abs(x1-x2);
    int a2 = abs(y1-y2);
    if (a1 <= 1 && a2 <= 1) {
            cout << 8;
    }
    else cout << 2*(abs(x1-x2) + abs(y1-y2)+2);
    return 0;
}

#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=1e9+7;
int ABS(int x){
	return x<0?-x:x;
}
int main(){
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	cout<<2*(ABS(x1-x2)+ABS(x2-y2)+2+2*(x1==x2)+2*(y1==y2));
}

#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int min(int a, int b)
{
	if (a <= b)
		return a;
	return b;
}

int main(void)
{
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int x3 = 0, y3 = 0;
	int distance = abs(x2 - x1) + abs(y2 - y1);
	int ans = 0;
	if (x2 > x1 && y2 > y1)
	{
		x3 = x2 + 1; y3 = y2 + 1;
	}
	else if (x2 > x1 && y2 < y1)
	{
		x3 = x2 + 1; y3 = y2 - 1;
	}
	else if (x2 < x1 && y2 > y1)
	{
		x3 = x2 - 1; y3 = y2 - 1;
	}
	else if (x2 < x1 && y2 > y1)
	{
		x3 = x2 - 1; y3 = y2 + 1;
	}
	else if (x2 == x1 || y2 == y1)
	{
		ans = (distance  + 1)* 2 + 4;
		cout << ans;
		return 0;
	}
	//cout << distance << endl;
	//cout << x3 << " " << y3 << endl;
	ans = 2 * abs(x3 - x1) + 2 * abs(y3 - y1);
	cout << ans;
		//_getch();
	return 0;
}

#include <iostream>
using namespace std;
int main () {
	int x, y, x1, y1, count = 0, count1 = 0;
	cin>> x >> y >> x1 >> y1;
	if ( x < 0)
		x = x * (-1);
	if ( x1 < 0)
		x1 = x1 * (-1);
	if ( y < 0 )
		y = y * (-1);
	if ( y1 < 0 )
		y1 = y1 * (-1);
	if ( x == 0 && x1 ==0 )
		count += 2;
	else if ( x > x1)
		count += ( x - x1 ) + 1;
	else
		count += ( x1 - x ) + 1;
	count *= 2;
	if ( y == 0 && y1 == 0 )
		count1 += 2;
	else if ( y > y1 )
		count1 += ( y - y1 ) + 1;
	else
		count1 += ( y1 - y ) + 1;
	count1 *= 2;
	cout<< count + count1 << endl;
	return 0;
}

#include<iostream>
#include<sstream>
#include<vector>
#include<functional>
#include<math.h>
#include<algorithm>
#include<set>
using namespace std;

int main()
{
    int x1,y1;
    int x2,y2;
    cin>>x1>>y1;
    cin>>x2>>y2;
    if(x1 != x2 && y1 != y2){
        int a,b;
        if(x1>x2){
            a = x1-x2+1;
        }
        else{
            a = x2-x1+1;
        }
        if(y1>y2){
            b = y1-y2+1;
        }
        else{
            b = y2-y1+1;
        }
        cout<<2*(a+b);
    }
    if(x1 == x2 && y1 == y2){
        cout<<10;
    }
    if(x1 == x2 && y1 != y2){
        int b;
        if(y1>y2){
            b = y1-y2+1;
        }
        else{
            b = y2-y1+1;
        }
        cout<<2*(2+b);
    }
    if(x1 != x1 && y1 == y2){
        int a;
        if(x1>x2){
            a = x1-x2+1;
        }
        else{
            a = x2-x1+1;
        }
        cout<<2*(2+a);
    }
    return 0;
}

#include<iostream>

#include<vector>

#include<string>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>

using namespace std;
#define ll long long
struct rec{
int x1,x2,y1,y2;
};

int main(){

	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int ans=0;
	ans=((abs(a-c)+abs(b-d)-1)*2);
	if(ans==0)
		ans=8;
	else ans=ans+6;
		cout<<ans<<endl;
//rec	a[4];
//
//for(int i=0;i<4;i++){
//cin>>a[i].x1>>a[i].y1>>a[i].x2>>a[i].y2;
//}
//bool isr=0;
//for(int i=0;!isr&&i<4;i++)
//	for(int j=i+1;j<4;j++)
//	{
//	if(a[i].y1==a[j].x1 &&a[i].y2==a[j].x2 )
//	{
//	if(a[i].x1!=a[j].x1 &&a[i].x2!=a[j].x2&&a[i].y2!=a[j].y2&&a[i].y1!=a[j].y1 )
//		isr=1;
//	}
//
//	}
//	if(isr)
//cout<<"yes\n";
//	else
//	cout<<"NO\n";
//
/*
	map<string ,int >m;
	int n;
	cin>>n;
	string str;
	while(n--){
	cin>>str;
	int ind=str.find("oo");
	while(ind!=-1){
	str[ind]='u';
	str.erase(str.begin()+ind+1);
	ind=str.find("oo");

	}
		 ind=str.find("kh");
	while(ind!=-1){
	str[ind]='h';
	str.erase(str.begin()+ind+1);
	ind=str.find("kh");

	}
	sort(str.begin(),str.end());
	m[str]++;
	}
	cout<<m.size()<<endl;*/
return 0;
}

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

int main()
{
    int a,b,x,y;
    scanf("%d%d%d%d",&a,&b,&x,&y);
    if((a-x)*(a-x)+(b-y)*(b-y)<=2){
        printf("8\n");
        return 0;
    }
    int xx=a>=x?x-1:x+1;
    int yy=b>=y?y-1:y+1;
    printf("%d\n",2*abs(a-xx)+2*abs(b-yy));
    return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << 2 * abs(x1 - x2) + 2* abs(y1 - y2) + 4 << endl;
}

#include<iostream>
#define ll long long int
#include<string>
using namespace std;
#include<vector>
#include<set>
#include<algorithm>
#define MOD 1000000007
#include<cmath>
#include<cstring>
#include<cstdio>
int main()
{

    ll x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    ll cou=(abs(x2-x2)+1)*2+(abs(y2-y1)+1)*2;
    if(x1==x2||y1==y2)
    {
        cou=cou+2;
    }

    cout<<cou<<"\n";
}

#include <iostream>
#include <algorithm>
using namespace std;

int startX, startY;
int endX, endY;

int findLength()
{
	int destX = max(2, abs(startX - endX) + 1);
	int destY = max(2, abs(startY - endY) + 1);

	return (destX + destY) * 2;
}

int main()
{
	freopen("input.txt", "r", stdin);

	cin >> startX >> startY >> endX >> endY;
	cout << findLength() << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int a, b, x, y, co;
    cin>>a>>b>>x>>y;
    co=abs(a-x)+abs(b-y);
    if(co>2)
    cout<<co*2+4<<endl;
    else
    cout<<8<<endl;
}

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define all(c) c.begin(),c.end()
#define rep(i,a,n) for(long long i=a;i<=n;i++)
typedef long long ll;
typedef long double ld;

#define NDEBUG
#ifdef NDEBUG
#define debug(...)
#else
#include"debug.cpp"
#endif

const int N=2e5+5;
long long test, n, m, k, x, y, z, ans, q, a[N],b[N];
string s;
void solve(){
	int x1 , x2 , y1, y2; cin >>x1 >> y1 >>x2 >> y2;
	if(x1==x2 || y1==y2){
		cout<<8+(abs(x1-x2)+abs(y1-y2)-1);
	}
	else{
		cout<<2*(abs(x1-x2)+abs(y1-y2)+2);
	}
}

int main(){ //freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//cin >> test;
	//while(test--)
	solve();
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
typedef long long ll;

const int MAXN = 300000;

ll h[MAXN];
ll s[MAXN];
ll g[MAXN];
ll fol[MAXN];
ll ans[MAXN];

int main()
{
    int n;
    cin >> n;
    int min_ind = 1;
    for (int i = 1; i <= n; i++)
    {
        cin >> s[i] >> g[i];
        h[i] = s[i] + g[i];
        if (h[i] < h[min_ind])
        {
            min_ind = i;
        }
    }

    int i = min_ind;
    int x = h[i];

    for (int j = i + 1; j <= n; j++)
        fol[h[j] + (j-i) - x] = j;
    fol[0] = i;

    int line = 0;
    ans[i] = x;
    for (int j = i + 1; j <= n; j++)
    {
        if (j <= fol[line])
        {
            ans[j] = ans[j-1] - 1;
        }
        else if (j <= fol[line+1])
        {
            ans[j] = ans[j-1];
            line++;
        }
        else
        {
            ans[j] = ans[j-1] + 1;
            line += 2;
        }
    }

    for (int j = 1; j < i; j++)
        fol[j] = n+1;
    fol[0] = i;
    for (int j = i-1; j >= 0; j--)
        fol[h[j] + (i-j) - x] = j;

    line = 0;
    for (int j = i-1; j >= 0; j--)
    {
        if (j >= fol[line])
        {
            ans[j] = ans[j-1] - 1;
        }
        else if (j >= fol[line+1])
        {
            ans[j] = ans[j-1];
            line++;
        }
        else
        {
            ans[j] = ans[j-1] + 1;
            line += 2;
        }
    }

    ll sum = 0;
    for (int i = 1; i <= n; i++)
    {
        if (ans[i] < s[i])
        {
            cout << -1;
            return 0;
        }
        sum += ans[i] - s[i];
    }

    cout << sum << endl;
    for (int i = 1; i <= n; i++)
    {
        cout << ans[i] << " ";
    }

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define lp(n) for(i=0;i<n;i++)
#define lpi(i,n) for(i=0;i<n;i++)
#define coutY printf("YES\n")
#define coutN printf("NO\n")
#define in(a) scanf("%d",&a)
#define inll(a) scanf("%lld",&a)
#define ind(a) scanf("%lf",&a)
#define ins(a) scanf("%s",&a)
#define out(a) printf("%d\n",a)
#define outll(a) printf("%lld\n",a)
#define outd(a) printf("%lf\n",a)
#define outs(a) printf("%s\n",a)

 using namespace std;

 int main(){
    int x1,x2,y1,y2,a,b;
    in(x1);in(y1);
    in(x2);in(y2);
    a=(x1*x2>=0)?(abs(x1-x2)+1):(abs(x1)+abs(x2)+1);
    b=(y1*y2>=0)?(abs(y1-y2)+1):(abs(y1)+abs(y2)+1);
    cout<<2*(a+b)<<"\n";
    return 0;
}

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{int a,b,x1,y1,x2,y2,c;
cin>>x1>>y1;
cin>>x2>>y2;

if(x2<x1){
a=((x2-x1)*(-1))+1;}
else if(x2>x1){
a=x2-x1+1;  }
else {
     a=x2-x1+2;}
if(y1<y2){
b=((y1-y2)*(-1))+1;}
else if(y1>y2){
b=y1-y2+1;}
else if(y1=y2){
     }
c=a+b+a+b;
cout<<c;
    //system("PAUSE");
    return 0;
}

#include <iostream>

using namespace std;

#define ABS(x) ((x)>0?(x):-(x))
typedef pair<int,int> point;

int main()
{
	point start,flag;
	int ans=0;
	cin>>start.first>>start.second>>flag.first>>flag.second;
	if((start.first-flag.first==1)||(start.second-flag.second==1))
	{
		cout<<8;
		return 0;
	}
	if(start.first==flag.first)
	{
		ans=8+2*ABS(start.second-flag.second);
	}
	else
	{
		if(start.second==flag.second)
		{
			ans=8+2*ABS(start.first-flag.first);
		}
		else
		{
			ans=2*(ABS(start.first-flag.first)+ABS(start.second-flag.second)+2);
		}
	}
	cout<<ans;
	return 0;
}

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int x,y;
    int a,b;
    cin>>x>>y;
    cin>>a>>b;
    cout<<abs(a-x+2)*abs(b-y+2)<<endl;
    return 0;
}

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int x1,x2,y1,y2;
        cin>>x1>>y1>>x2>>y2;
        if(x1==x2){
            cout<<4*(abs(y2-y1)+1);
        }
        else if(y1==y2){
            cout<<2*(abs(x2-x1)+1);
        }
        else{
            cout<<2*(abs(y2-y1)+abs(x2-x1)+2);
        }
        return 0;
    }

/*
Author: QAQ-Automaton
LANG: C++
PROG: M.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const signed inf=0x3f3f3f3f;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	inline bool read (signed &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}

	inline bool read (long long &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		x=gc();
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r')if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	// print a signed integer
	inline bool write (signed x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}

	inline bool write (long long x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
#define y1 orzdisposrestfully
int main(){
#ifdef QAQAutoMaton
	freopen("M.in","r",stdin);
	freopen("M.out","w",stdout);
#endif
	int x1,y1,x2,y2;
	read(x1,y1,x2,y2);
	if(x1==y1)return write(6+2*abs(x2-y2),'\n');
	if(x2==y2)return write(6+2*abs(x1-y1),'\n');
	return write((abs(x1-(x1<x2?x2+1:x2-1))+abs(y1-(y1<y2?y2+1:y2-1)))<<1,'\n');
	return 0;
}

// Example program
#include <iostream>
using namespace std;
#include <math.h>

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    if(fabs(a-c)==1 || fabs(b-d)==1){
        cout<<2*(fabs(a-c)+fabs(b-d))+4+2;
    }
    else{
        cout<<2*(fabs(a-c)+fabs(b-d))+4;
    }
}

#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=1e9+7;
int ABS(int x){
	return x<0?-x:x;
}
int main(){
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	cout<<2*(ABS(x1-x2)+ABS(x2-y2)+2+(x1==x2)+(y1==y2));
}

#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    ll answ = (abs(x1-(x2+1))+abs(y1-(y2+1)))*2;
    answ = max(answ,(abs(x1-(x2+1))+abs(y1-(y2-1)))*2);
    answ = max(answ,(abs(x1-(x2-1))+abs(y1-(y2-1)))*2);
    answ = max(answ,(abs(x1-(x2-1))+abs(y1-(y2+1)))*2);
    cout << max(answ,(ll)8) << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
const int MAX_N = 3*100000 + 1234;
const int INF = 1000000000 + 1;

int n , k;

int a[MAX_N];

bool ok[MAX_N];

bool can ( int x ) {
    for ( int i = 0 ; i <= n ; i++ ) ok[i] = false;

    ok[0] = true;

    int last = 0;

    for ( int i = 1 ; i <= n ; i++ ) {
        if ( a[i] - a[last] <= x )
            ok[i] = true;
        else {

            if ( i >= k ) {
                if ( a[i] - a[i-k+1] <= x )
                    ok[i] = ok[i-k];
                else
                    ok[i] = false;
            }
            else {
                ok[i] = false;
            }

        }
    }

    return ok[n];

}

int main() {

    scanf ( "%i %i", &n , &k );

    for ( int i = 0 ; i < n ; i++ )
        scanf ( "%i" , &a[i] );
    a[0] = -INF;
    sort ( a , a+(n+1) );

    int L = 0;
    int R = INF+22;
    if ( can(0) ) R = 0;
    while ( L + 1 < R ) {
        int med = ( L + R ) / 2;

        if ( can(med ) )
            R = med;
        else
            L = med;
    }

    printf ( "%i\n" , R );

    return 0;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>

using namespace std;
const int maxn = 2100;
vector<int>e[maxn][2];
int d[maxn];
char str[maxn];
int n;
int bfs(int u,int id)
{
	for(int i = 0;i<=n;i++)d[i]=0;
	queue<int>q;
    q.push(u);
	d[u]=0;
	while(!q.empty())
	{
		int uu = q.front();q.pop();
		for(int i = 0;i<e[uu][id].size();i++)
		{
			int v = e[uu][id][i];
			if(d[v])continue;
			q.push(v);
			d[v]=d[uu]+1;
			if(d[v]>=2)return true;
		}
	}
	return false;
}
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d",&n);
		for(int i = 0;i<=n;i++)
			for(int j = 0;j<2;j++)
				e[i][j].clear();
		char x;
		for(int i = 1;i<=n;i++)
		{
			scanf("%s",str);
			for(int j = 0;j<n;j++)
			{
				if(str[j]=='P')
					e[i][0].push_back(j+1);
				else if(str[j]=='Q')
					e[i][1].push_back(j+1);
			}
		}
		int flag1 = 0;
		int flag2 = 0;
		for(int i = 1;i<=n;i++)
		{
			flag1 = bfs(i,0);
			if(flag1)
			   break;
			flag2 = bfs(i,1);
			if(flag2)break;
		}
		if(flag1 || flag2)
		    printf("N\n");
		else printf("T\n");
	}
}

#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
	int x1, y1, x2, y2, x, y;
	cin>>x1>>y1>>x2>>y2;
	x=sqrt(x1*x1)-sqrt(x2*x2);
	y=sqrt(y1*y1)-sqrt(y2*y2);
	if (x<0)
		x=x*(-1);
	if (y<0)
		y=y*(-1);
	if (x1==x2 || y1==y2)
		x++;
	x++;
	y++;
	cout<<2*(x+y);
}

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

int main()
{
    int x1, x2, y1, y2;
    cin >> x1 >> x2 >> y1 >> y2;
    int d = (abs(x1 - x2) + abs(y1 - y2) + 2) * 2;
    if (x1 == x2 || y1 == y2) //共线情况
        d += 2;
    cout << d << endl;
    return 0;
}

#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
   ll x1, x2, y1, y2;
   cin >> x1 >> y1 >> x2 >> y2;

    if(x1 != x2 && y1 != y2){
        ll ax = abs(x2 + 1), ay = abs(y2 + 1);
        ll bx = abs(x2 - 1), by = abs(y2 + 1);
        ll cx = abs(x2 - 1), cy = abs(y2 - 1);
        ll dx = abs(x2 + 1), dy = abs(y2 - 1);

        ll da = abs(ax - x1) + abs(ay - y1),
           db = abs(bx - x1) + abs(by - y1),
           dc = abs(cx - x1) + abs(cy - y1),
           dd = abs(dx - x1) + abs(dy - y1);

        ll max1 = max(da, db),
           max2 = max(max1, dc),
           max3 = max(max2, dd);

        if(max3 == da){
            x2 = abs(x2 + 1);
            y2 = abs(y2 + 1);
        }
        else if(max3 == db){
            x2 = abs(x2 - 1);
            y2 = abs(y2 + 1);
        }
        else if(max3 == dc){
            x2 = abs(x2 - 1);
            y2 = abs(y2 - 1);
        }
        else if(max3 == dd){
            x2 = abs(x2 + 1);
            y2 = abs(y2 - 1);
        }
        cout << 2 * abs(x1 - x2) + 2 * abs(y1 - y2);
   }
   else if(x1 == x2){
        cout << 2 * (abs(x1) + 2) + 2 * (max(abs(y1), abs(y2)) + 1);
   }
   else if(y1 == y2){
        cout << 2 * (abs(y1) + 2) + 2 * (max(abs(x1), abs(x2)) + 1);
   }
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   if (a==b) cout<<2*sqrt((c-d)*(c-d))+6;
   else
   {
       if (c==d) cout<<2*sqrt((a-b)*(a-b))+6;
       else cout<<2*sqrt((a-b)*(a-b))+2*sqrt((c-d)*(c-d))+4;
   }
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
   int x1,x2,x,y1,y2,y;
   cin >> x1 >> x2 >> y1 >> y2 ;
   if(x1==x2)x=2;
        else x = abs(x1-x2)+1;
   if(y1==y2)y=2;
        else y = abs(y1-y2)+1;
    cout << (y+x)*2<<endl;

    return 0;
}

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

int dirx[8]={0,0,1,-1,1,1,-1,-1};
int diry[8]={1,-1,0,0,1,-1,1,-1};
#define ll             long long
#define sc1(a)         scanf("%d",&a)
#define llsc1(a)       scanf("%lld",&a)
#define sc2(a,b)       scanf("%d %d",&a,&b)
#define llsc2(a,b)     scanf("%lld %lld",&a,&b)
#define sc3(a,b,c)     scanf("%d %d %d",&a,&b,&c)
#define llsc3(a,b,c)   scanf("%lld %lld %lld",&a,&b,&c)
#define pf             printf
#define cpfl(s)        cout<<s<<endl
#define cpf(s)         cout<<s
#define FOR(a)         for(ll i=0;i<a;i++)
#define inf            2e9
#define pr             pair<ll,ll>
#define newline        printf("\n")
#define mem(a,b)       memset(a,b,sizeof(a))
#define srt(a,n)       sort(a,a+n)
#define mx             100005
#define mm             1420
#define mod            1000000007
#define frd            freopen("input.txt","r",stdin)
#define fpf            freopen("output.txt","w",stdout)
bool chk(int x,int y,int x1,int y1)
    {
        /*int t=x1+1,tt=y1;
        if(x==t && y==tt){
            cpfl(8);
            return true;
        }
        t=x1-1;tt=y1;
        if(x==t && y==tt){
            cpfl(8);
            return true;
        }
        t=x1;tt=y1+1;
        if(x==t && y==tt){
            cpfl(8);
            return true;
        }
        t=x1;tt=y1-1;
        if(x==t && y==tt){
            cpfl(8);
            return true;
        }*/
        for(int i=0;i<8;i++){
            int t=x1+dirx[i];
            int tt=y1+diry[i];
            if(x==t && y==tt){
                cpfl(8);
                return true;
            }
        }
        return false;
    }
int main()
    {
        int x,y,x1,y1,t,tt,ans=inf,tmp,p,pp;
        cin>>x>>y>>x1>>y1;
        if(chk(x,y,x1,y1))return 0;
        t=y1+1;
        tt=y1-1;
        p=(x-x1);
        pp=(y-t);
        (p<0)?p*=-1:p;
        (pp<0)?pp*=-1:pp;
        tmp=p+pp;
        pp=y-tt;
        (pp<0)?pp*=-1:pp;
        tmp+=(p+pp);
        ans=min(ans,tmp);
        t=x1+1;
        tt=x1-1;
        p=(x-t);
        pp=(y-y1);
        (p<0)?p*=-1:p;
        (pp<0)?pp*=-1:pp;
        tmp=p+pp;
        p=x-tt;
        (p<0)?p*=-1:p;
        tmp+=(p+pp);
        ans=min(ans,tmp);
        cpfl(ans+4);
        return 0;
    }

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int x1,y1,x2,y2;
  cin >> x1>>y1>>x2>>y2;
  x1 = abs(x1-x2);
  y1 = abs(y1-y2);
  if( x1==0 || y1==0)
     printf("%d",x1!=0 ? x1 : y1);
  else
     printf("%d",2*(x1+y1)+4);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	int x1, y1, x2, y2;
	cin >> x1 >> x2 >> y1 >> y2;
	int ans = INT32_MAX;
	ans = min(ans, abs(x1 - x2 - 1) + abs(y1 - y2 - 1) + abs(x1 - x2 - 1) + abs(y1 - y2 + 1));
	ans = min(ans, abs(x1 - x2 - 1) + abs(y1 - y2 - 1) + abs(x1 - x2 + 1) + abs(y1 - y2 - 1));
	ans = min(ans, abs(x1 - x2 + 1) + abs(y1 - y2 + 1) + abs(x1 - x2 + 1) + abs(y1 - y2 - 1));
	ans = min(ans, abs(x1 - x2 + 1) + abs(y1 - y2 + 1) + abs(x1 - x2 - 1) + abs(y1 - y2 + 1));
	cout << ans + 6 << '\n';
}

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

int main(){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;

    int ans;
    if(x1==x2) ans=4*(abs(y1-y2)+1);
    else if(y1==y2) ans=4*(abs(x1-x2)+1);
    else ans=2*(abs(x1-x2)+abs(y1-y2)+2);
    cout<<ans<<endl;
}

//QUESTION LINK
//https://codeforces.com/problemset/problem/883/M
//GREEDY
//just simple trial and error math

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

    int main()
    {

    int x1,y1,x2,y2;
    int ans=0;
    cin>>x1>>y1>>x2>>y2;
    ans=(abs(x1-x2)+abs(y1-y2)+2)*2;
    if(!(x1-x2)||!(y1-y2)) ans+=2;

}

#include <bits/stdc++.h>

using namespace std;

#define EPS 1e-9
#define inf 0x3f3f33f
#define F first
#define S second
#define pii pair<int, int>
#define ll long long
#define sc(x) scanf("%d", &x)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), xrend()

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stout);
	#endif
	int a[4];
	for(int i=0;i<4;i++) cin>>a[i], a[i]+=100;
	int d = abs(a[0]-a[2])+abs(a[1]-a[3]);
	if(d<=2) cout<<8<<endl;
	else cout<<(d-2)*2+8<<endl;
	return 0;
}

#include <iostream>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

#define PI 3.14159265358979323846
#define eps 1e-7
#define ll long long
#define ACCEPTED return 0;
#define PAUSE  system("pause");

const int maxint = 2147483647;
const int minint = -2147483647;
const unsigned int maxunint = 4294967295;

int main() {

	/*#ifdef _DEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#endif*/

	int x1, y1, x2, y2,d,x11,x22,y11,y22;
	cin >> x11 >> y11 >> x22 >> y22;
	x2 = max(x11, x22);
	x1 = min(x11, x22);
	y2 = max(y11, y22);
	y1 = min(y11, y22);
	if ((abs(x1 - x2) == 1) || (abs(y1 - y2) == 1)) {
		cout << 8;
		//PAUSE
			ACCEPTED
	}
	if ((y1 == y2)) {
		d = abs(2 * (x2 - x1 + 1)) + 2 * 2;
		cout << d;
		//PAUSE
			ACCEPTED
	}
	if ((x1 == x2)) {
		d = abs(2 * (y2 - y1 + 1)) + 2 * 2;
		cout << d;
		//PAUSE
			ACCEPTED
	}
	d = 2*abs(x2+1-x1) + 2 * abs(-y1 + y2 + 1);
	cout << d;
	//PAUSE
		ACCEPTED
}

#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x1,y1,x2,y2;
    cin>>x1>>y1;
    cin>>x2>>y2;
    if(x1==x2)
    {
        cout<<(4+2*(abs(y1-y2)+1))<<"\n";
    }
    else if(y1==y2)
        {
        cout<<(4+2*abs(x1-x2))<<"\n";
        }
    else cout<<(2*(abs(x1-x2)+1)+2*(abs(y1-y2)+1))<<"\n";

    return 0;
}

#include <bits/stdc++.h>

using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<2*(abs(a-c)+abs(b-d)+2);
}

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

void solve() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << max(8ll, 2*(abs(x2 - x1) + 2 + abs(y2 - y1)));
}

signed main() {
    #ifdef _DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();

    #ifdef _DEBUG
        cout << "\n\nproc time: " << 1.0 * clock() / CLOCKS_PER_SEC << "s    ";
    #endif

}

#include<bits/stdc++.h>
using namespace std;
int X, x, Y, y;
int main()
{
cin>>X>>x>>Y>>y;
if (X==x || Y==y){
         cout<<2*abs(X-x)+2*abs(Y-y)+6;  return 0;
         }
cout<<2*abs(X-x)+2*abs(Y-y)+4;
 return 0;

}

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a == c || a == c - 1 || a == c + 1)
	{
		cout << (2 + abs(d - b) + 1) * 2 << endl;
		return 0;
	}
	else if (b == d || b == d - 1 || b == d + 1)
	{
		cout << (2 + abs(a - c) + 1) * 2 << endl;
		return 0;
	}
	int x = abs(c - a);
	int y = abs(d - b);
	y++;
	x++;
	cout << (x + y) * 2 << endl;

}

#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<queue>
#include<utility>
#define qe 200
using namespace std;

long long sx,sy,ex,ey,totans=0;

int main()
{
    scanf("%ld%ld%ld%ld",&sy,&sx,&ey,&ex);

    if (sx==ex) totans=(abs(sy-ey)-1)*2+8;
    else if (sy==ey) totans=(abs(sx-ex)-1)*2+8;
    else
    {
        totans=6+abs(sx-ex)*2+(abs(sy-ey)-1)*2;
    }
    cout<<totans<<endl;
    return 0;
}

#include <iostream>
using namespace std;

#define ABS(x) (x > 0? x:- (x))

int main(){
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >>y2;
        cout << (ABS(x2 -x1) +ABS(y2 - y1) + 2)*2;
        return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

void solve() {
  int xa, ya, xb, yb;
  cin >> xa >> xb >> ya >> yb;
  cout << 2 * (max(abs(xa-xb) + 1, 2) + max(abs(ya - yb)+ 1, 2)) << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}

#include <iostream>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

#define PI 3.14159265358979323846
#define eps 1e-7
#define ll long long
#define ACCEPTED return 0;
#define PAUSE system("pause");

const int maxint = 2147483647;
const int minint = -2147483647;
const unsigned int maxunint = 4294967295;

int main() {

	/*#ifdef _DEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#endif*/

	int x1, y1, x2, y2,d;
	cin >> x1 >> y1 >> x2 >> y2;
	if ((abs(x1 - x2) == 1) || (abs(y1 - y2) == 1)) {
		cout << 8;
		//PAUSE
			ACCEPTED
	}
	if ((y1 == y2)) {
		d = abs(2 * (x2 - x1 + 1)) + 2 * 2;
		cout << d;
		//PAUSE
			ACCEPTED
	}
	if ((x1 == x2)) {
		d = abs(2 * (y2 - y1 + 1)) + 2 * 2;
		cout << d;
		//PAUSE
			ACCEPTED
	}
	d = 2*abs(x2+1-x1) + 2 * abs(y1 - y2 + 1);
	cout << d;
	//PAUSE
		ACCEPTED
}

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define MOD 1000000007
#define PI acos(-1)
int main()
{
	IOS
	ll x,y,a,b;
	cin>>x>>y>>a>>b;
	ll xdis=0;
	ll ydis=0;
	if(y==b)
	{
		xdis=abs(x-a)*2+2;
		ydis=4;
		cout<<xdis+ydis;
	}
	else if(x==a)
	{
		cout<<2*abs(y-b+1)+4;
	}
	else
	{
		cout<<2*abs(x-a)+2*abs(y-b)+4;
	}
}

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
#define MAX 201
bool V[MAX][MAX];
int dr[]={-1,1,0,0};
int dc[]={0,0,-1,1};
bool can(int x,int y)
{
	if(x>=MAX || y>=MAX || y<0 || x<0 || V[x][y])return false;
	return true;
}
int BFS(int xs, int ys, int xt, int yt)
{
	priority_queue<iii, vector<iii> ,greater<iii> > q;
	V[xs][ys]=true;
	int ans=-1;
	q.push(iii(0,ii(xs,ys)));
	while(!q.empty() && ans==-1)
	{
		iii front = q.top();
		q.pop();
		int depth = front.first;
		int xx=front.second.first, yy=front.second.second;
		for(int i=0;i<4;i++)
		{
			int nx=xx+dr[i],ny=yy+dc[i];
			if(nx == xt && ny ==yt)
			{
				ans=depth+1;
				break;
			}
			if(can(nx,ny))
			{
				V[nx][ny]=true;
				q.push(iii(depth+1,ii(nx,ny)));
			}
		}
	}
	return ans;
}
int main() {
	// your code goes here
	memset(V, false, sizeof V);
	int xs,xt,ys,yt;
	scanf("%d %d %d %d",&xs, &ys, &xt,&yt);
	xt+=100;
	yt+=100;
	xs+=100;
	ys+=100;
	V[xt][yt]=true;
	if(xt>xs)xt++;
	else if(xt<xs)xt--;

	if(yt>ys)yt++;
	else if(yt<ys)yt--;
	cout<<2*BFS(xs,ys,xt,yt);
	return 0;
}

#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
    cout <<"Enter the starting point "<<endl;
    int x1,y1,x2,y2;
    cin >> x1>>y1>>x2>>y2;
    cout << 2*(abs(x2-x1)+abs(y2-y1)+2);
    return 0;

}

#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int x,y,a,b;
	cin>>x>>y>>a>>b;
	int ans;
	if (x!=a && y!=b){
		cout<<2*(abs(x-a)+2+abs(y-b));
	}
	else {
		cout<<2*(abs(x-a)+4+abs(y-b));
	}

	//system("pause");
	//return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define y1 kqwjeklqwjekq

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pl;
typedef pair<pair<int,int>,int> ii;

int x1,y1,x2,y2;

int main() {
	scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
	if(x1==x2) {
		printf("%d\n",4+2*abs(y1-y2)+2);
	} else if (y1==y2) {
		printf("%d\n",4+2*abs(x1-x2)+2);
	} else if(y1<y2) {
		printf("%d\n",2*((y2-y1)+1)+2*(abs(x1-x2))+1);
	} else if(y1>y2) {
		printf("%d\n",2*((y1-y2)+1)+2*(abs(x1-x2)+1));
	}
	return 0;
}

#include <cmath>
#include<iostream>

using namespace std;

int main()
{

    int x1,x2,y1,y2,q,w;
    cin>>x1>>y1>>x2>>y2;

    if (x1==x2)
    {
        q=2*(abs((y2-1)-y1))+4;
      cout<<q; return 0;
    }
    if(y1==y2)
    {
        w=2*(abs((x2-1)-x1))+4;
     cout<<w; return 0;
    }

     q=(abs((x1-x2))+1)*2;
     w=(abs((y1-y2))+1)*2;

    cout<<q+w;
    return 0;
}

#include<cstdio>
#include<cstdlib>
#include<iostream>
//#include<fstream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<set>
#include<string>
#include<map>
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int, int> P;
typedef long long ll;
#define fi first
#define se scond
#define me(x) memset(x, -1, sizeof(x))
#define mem(x) memset(x, 0, sizeof(x))
#define N 200000+5
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll i, j, k=0, l=0, r;
    ll n, m, t, x, y, a, b;
    cin>>x>>y>>a>>b;
    x=abs(x-a)+1;
    y=abs(y-b)+1;
    if(!x) x++;
    if(!y) y++;
    cout<<2*(x+y)<<endl;
    return 0;
}

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

int main(){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;

    int ans;
    if(x1==x2) ans=4*(abs(y1-y2)+1);
    else if(y1==y2) ans=4*(abs(x1-x2)+1);
    else ans=2*(abs(x1-x2)+abs(y1-y2)+2);
    cout<<ans<<endl;
}

#include <iostream>
using namespace std;
int main () {
	int x, y, x1, y1, count = 0;
	cin>> x >> y >> x1 >> y1;
	if ( x < 0)
		x = x * (-1);
	if ( x1 < 0)
		x1 = x1 * (-1);
	if ( y < 0 )
		y = y * (-1);
	if ( y1 < 0 )
		y1 = y1 * (-1);
	if ( x > x1)
		count += ( x - x1 ) + 1;
	else
		count += ( x1 - x ) + 1;
	if ( y > y1 )
		count += ( y - y1 ) + 1;
	else
		count += ( y1 - y ) + 1;
	return 0;
}

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

using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'

template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

struct Scanner {
  int fd = -1;
  char line[(1 << 15) + 1];
  size_t st = 0, ed = 0;
  void reread() {
    memmove(line, line + st, ed - st);
    ed -= st;
    st = 0;
    ed += ::read(fd, line + ed, (1 << 15) - ed);
    line[ed] = '\0';
  }
  bool succ() {
    while (true) {
      if (st == ed) {
        reread();
        if (st == ed) return false;
      }
      while (st != ed && isspace(line[st])) st++;
      if (st != ed) break;
    }
    if (ed - st <= 50) {
      bool sep = false;
      for (size_t i = st; i < ed; i++) {
        if (isspace(line[i])) {
          sep = true;
          break;
        }
      }
      if (!sep) reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
  bool read_single(T& ref) {
    if (!succ()) return false;
    while (true) {
      size_t sz = 0;
      while (st + sz < ed && !isspace(line[st + sz])) sz++;
      ref.append(line + st, sz);
      st += sz;
      if (!sz || st != ed) break;
      reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  bool read_single(T& ref) {
    if (!succ()) return false;
    bool neg = false;
    if (line[st] == '-') {
      neg = true;
      st++;
    }
    ref = T(0);
    while (isdigit(line[st])) {
      ref = 10 * ref + (line[st++] & 0xf);
    }
    if (neg) ref = -ref;
    return true;
  }
  template <class T> bool read_single(V<T>& ref) {
    for (auto& d : ref) {
      if (!read_single(d)) return false;
    }
    return true;
  }
  template <class T> bool read_single(array<T,2>& ref) {
    if (!read_single(ref[0])) return false;
    if (!read_single(ref[1])) return false;
    return true;
  }
  template <class T> bool read_single(array<T,3>& ref) {
    if (!read_single(ref[0])) return false;
    if (!read_single(ref[1])) return false;
    if (!read_single(ref[2])) return false;
    return true;
  }
  template <class T> bool read_single(array<T,4>& ref) {
    if (!read_single(ref[0])) return false;
    if (!read_single(ref[1])) return false;
    if (!read_single(ref[2])) return false;
    if (!read_single(ref[3])) return false;
    return true;
  }
  void read() {}
  template <class H, class... T> void read(H& h, T&... t) {
    bool f = read_single(h);
    assert(f);
    read(t...);
  }
  Scanner(FILE* fp) : fd(fileno(fp)) {}
};

struct Printer {
public:
  template <bool F = false> void write() {}
  template <bool F = false, class H, class... T>
  void write(const H& h, const T&... t) {
    if (F) write_single(' ');
    write_single(h);
    write<true>(t...);
  }
  template <class... T> void writeln(const T&... t) {
    write(t...);
    write_single('\n');
  }

  Printer(FILE* _fp) : fp(_fp) {}
  ~Printer() { flush(); }

private:
  static constexpr size_t SIZE = 1 << 15;
  FILE* fp;
  char line[SIZE], small[50];
  size_t pos = 0;
  void flush() {
    fwrite(line, 1, pos, fp);
    pos = 0;
  }
  void write_single(const char& val) {
    if (pos == SIZE) flush();
    line[pos++] = val;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  void write_single(T val) {
    if (pos > (1 << 15) - 50) flush();
    if (val == 0) {
      write_single('0');
      return;
    }
    if (val < 0) {
      write_single('-');
      val = -val; // todo min
    }
    size_t len = 0;
    while (val) {
      small[len++] = char(0x30 | (val % 10));
      val /= 10;
    }
    for (size_t i = 0; i < len; i++) {
      line[pos + i] = small[len - 1 - i];
    }
    pos += len;
  }
  void write_single(const string& s) {
    for (char c : s) write_single(c);
  }
  void write_single(const char* s) {
    size_t len = strlen(s);
    for (size_t i = 0; i < len; i++) write_single(s[i]);
  }
  template <class T> void write_single(const V<T>& val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write_single(' ');
      write_single(val[i]);
    }
  }
};

Scanner sc = Scanner(stdin);
Printer pr = Printer(stdout);
#define int ll

int32_t main() {
  ios::sync_with_stdio(0); cin.tie(0);

  ll x1,y1,x2,y2;
  sc.read(x1,y1,x2,y2);
  if (x1 == x2) {
    pr.writeln(4 + 2 + 2*abs(x1-x2));
    return 0;
  } else if (y1 == y2) {
    pr.writeln(4 + 2 + 2*abs(y1-y2));
    return 0;
  }
  pr.writeln(4 + 2*abs(y1-y2) + 2*abs(x1-x2));

}

/*
 * @Author: euLnaKt
 * @Date: 2017-10-21 16:25:32
 * @Last Modified by:   euLnaKt
 * @Last Modified time: 2017-10-21 16:25:32
 */

#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 420;
string s[maxn];

int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n;i++){
        cin >> s[i];
        int length = 0;
        while((length = s[i].find("u",length))!=-1){
            s[i].replace(length,1,"oo");
            length += 1;
        }
        int now = s[i].size() -1;
        while(now >=0){
            while(now >= 0 && s[i][now]!='h')
                now--;
            if(now < 0 )
                break;
            now -- ;
            int cnt = 0;
            bool kk = false;
            while(now >= 0 && s[i][now]=='k')
                now--,cnt++,kk = true;
            if(kk)
                s[i].replace(now + 1,cnt + 1,"h");
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++){
        bool flag = false;
        for (int j = 1; j < i; j++){
            if(s[i] == s[j]){
                flag = true;
                break;
            }
        }
        if(!flag)
            ans++;
    }
    printf("%d\n", ans);
    return 0;
}

#include <iostream>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

#define PI 3.14159265358979323846
#define eps 1e-7
#define ll long long
#define ACCEPTED return 0;
#define PAUSE  system("pause");

const int maxint = 2147483647;
const int minint = -2147483647;
const unsigned int maxunint = 4294967295;

int main() {

	/*#ifdef _DEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#endif*/

	int x1, y1, x2, y2,d;
	cin >> x1 >> y1 >> x2 >> y2;
	if ((abs(x1 - x2) == 1) || (abs(y1 - y2) == 1)) {
		cout << 8;
		//PAUSE
			ACCEPTED
	}
	if ((y1 == y2)) {
		d = (2 * (x2 - x1 + 1)) + 2 * 2;
		cout << d;
		//PAUSE
			ACCEPTED
	}
	if ((x1 == x2)) {
		d = (2 * (y2 - y1 + 1)) + 2 * 2;
		cout << d;
	//	PAUSE
			ACCEPTED
	}
	if (y1 > y2) {
		if (x1 > x2) {
			d = 2 * (y1 - y2 + 1 + x1 - x2 + 1);
		}
		else {
			d = 2 * (y1 - y2 + 1 + x2 - x1 + 1);
		}
	}
	else {
		if (x1 > x2) {
			d = 2 * (y2 + 1 - y1 + x1 - x2 + 1);
		}
		else {
			d = 2 * (y2 + 1 - y1 + x2 + 1 - x1);
		}
	}
	cout << d;
	//PAUSE
		ACCEPTED
}

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;
#define WGC main
int x,xx,y,yy,ans;
int read()
{
	int p=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		p=p*10+c-'0'; c=getchar();
	}
	return p*f;
}
int WGC()
{
	x=read();y=read();xx=read();yy=read();
	if((xx==x&&yy+1==y)||(xx+1==x&&yy+1==y)||(xx+1==x&&y==yy)||(xx+1==x&&y+1==yy)||(x==xx&&y+1==yy)||(x+1==xx&&y+1==yy)||(x+1==xx&&y==yy)||(x+1==xx&&y==yy+1))
	{
		printf("8\n");
		return 0;
	}
	ans=(2*(max(x,xx)-min(x,xx)+1)+2*(max(y,yy)-min(y,yy)+1));
	printf("%d\n",ans);
	return 0;
}

#include <cstdio>
#include <cstdlib>
using namespace std;
int x1,x2,y1,y2;
int main(){
	//freopen("txt.in","r",stdin);freopen("txt.out","w",stdout);
	scanf("%d %d\n%d %d\n",&x1,&y1,&x2,&y2);
	if(x1==x2&&y1==y2){printf("9");return 0;}
	if(x1==x2){
		printf("%d\n",(abs(y1-y2)+3)*2);return 0;
	}
	if(y1==y2){
		printf("%d\n",(abs(y1-y2)+3)*2);return 0;
	}
	printf("%d\n",(abs(x1-x2)+abs(y1-y2)+2)*2);
	return 0;
}

#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{
	int t,x1,x2,y1,y2,x,y;
	cin>>x1>>y1;
	cin>>x2>>y2;
	x=(max((x2-x1),(x1-x2)))*2 + 2;
	y=(max((y2-y1),(y1-y2)))*2 + 2;
	cout<<x+y;
	return 0;
}

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int x,y;
    int a,b;
    cin>>x>>y;
    cin>>a>>b;
    cout<<abs(a-x+2)*abs(b-y+2)<<endl;
    return 0;
}

#include<cstdio>
int sx,sy,ex,ey;
int main(){
	scanf("%d%d%d%d",&sx,&sy,&ex,&ey);
	int x=sx-sy,y=ex-ey;
	if(x<0) x=-x;if(y<0) y=-y;
	if(sx!=ex&&sy!=ey) printf("%d\n",(x+y+2)*2);
	else printf("%d\n",(x+y+2)*2+2);
}

#include <cmath>
#include<iostream>

using namespace std;

int main()
{
    int a=8;
    int x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    if(x1+x2+y1+y2<8)  {cout<<a; return 0;}
    int q=(abs((x1-x2))+1)*2;
    int w=(abs((y1-y2))+1)*2;
    cout<<q+w;
    return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

int h , w;
int main(){
    int x1 , x2 , y1 , y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if(x1 == x2 && x2 == y1 && y1 == y2){
        cout << "0\n";
        return 0;
    }
    if(x1 == x2){
        h = ((abs(abs(y1) - abs(y2)) + 1) * 2) + 4;
        cout << h;
        return 0 ;
    }
    if(y1 == y2){
        w = ((abs(abs(x1) - abs(x2)) + 1) * 2) + 4;
        cout << w ;
        return 0;
    }
    h = max(abs(x1),abs(x2)) - min(abs(x1),abs(x2)) + 1;
    w = max(abs(y1),abs(y2)) - min(abs(y1),abs(y2)) + 1;
    cout << (h + w) * 2;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 1e8   + 7;

int a, b, c, d;

main()
{
    cin >> a >> b >> c >> d;
    if (a == c) {
        cout << abs(b - d) + 6;
    }
    if (b == d) {
        cout << abs(a - c) + 6;
    }
    else
        cout << (abs(a - b) + abs(c - d)) * 2 + 4;
}

#include <bits/stdc++.h>
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int ui32;
const long long INFLL = 1e18;
using namespace std;

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int x1, y1;
    int x2, y2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    if (x1 == x2 || y1 == y2) {
        cout << 8 + max(0, abs(x1 - x2) - 1) + max(0, abs(y1 - y2) - 1) << endl;
        return 0;
    }
    int ans = 1e9;
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            int nx = x2 + i;
            int ny = y2 + j;
            if (min(x1, nx) < x2 && x2 < max(x2, nx) && min(y1, ny) < y2 && y2 < max(y1, ny))
                ans = min(ans, 2 * abs(nx - x1) + 2 * abs(ny - y1));
        }
    }
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int a, b, x, y, co;
    cin>>a>>b>>x>>y;
    co=abs(a-x)+abs(b-y);
    if(co>4)
    cout<<co*2+4<<endl;
    else
    cout<<8<<endl;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
  int x1, y1, x2, y2;
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  printf("%d", 8 + max(abs(x1 - x2) + abs(y1 - y2) - 2, 0) * 2);
  return 0;
}

// In The Name Of Allah

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

#define mp make_pair
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef vector<pii> vpii;

const int mod = 1000000007LL;
const int inf = 1e18;
const int maxx = 2e3 + 19;

int x, y, xx, yy;

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> x >> y;
    cin >> xx >> yy;
    if (x == xx || y == yy) {
        int ans = abs(x - xx) + abs(y - yy);
        cout << ans << endl;
        ans++;
        ans += ans;
        ans += 4;
        return cout << ans, 0;
    }
    int ans = abs(x - xx) + 1 + abs(y - yy) + 1;
    ans *= 2;
    cout << ans;
    return 0;
}

#include <iostream>

using namespace std;
int x1,y1,x2,y2,length=0,_max=0,k=0;
int kq=0;
int Try(int x,int y);
int main(){

    int dodai;
    cin>>x1>>y1;
    cin>>x2>>y2;
    k=0;
    if (y1==y2+1 || y1==y2-1) cout<<"8"<<endl;
    else

    {dodai=Try(x1,y1);
    cout<<dodai<<endl;
    }
}
int Try(int x,int y){

    if (kq==1  ){
        if (length>_max) _max=length;
        return _max;
    }
    else{
        if (x<x2){
            length++;
            x++;

        }
        else{
            if (x>x2) {
                length++;
                x--;
            }
            else{
                if (y<y2){
                    length++;
                    y++;
                    k=1;

                }
                else{
                    if (y>y2){
                        y--;
                        length++;
                        k=1;
                    }
                    else{

                      //  length++;
                        y++;
                          if (k==1) length--;
                        length=length+ (length-1);

                       //  length--;
                        length+=7;
                        kq=1;

                    }
                }
            }

        }
        if (kq==1) return length;
        // cout<<length<<endl;
            Try(x,y);
    }

}

#include<iostream>
#include<cmath>
using namespace std;

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> x2 >> y1 >> y2;
	double distance = sqrt(pow((x1-x2), 2) + pow((y1-y2),2));
	if (distance == 1 || distance == sqrt(2)) {
		cout << 8 << endl;
		return 0;
	}
	int xdiff = abs(x1 - x2);
	int ydiff = abs(y1 - y2);
	int result = xdiff + 1 + ydiff + 1 + 2 + 2 + abs(xdiff - 1) + abs(ydiff - 1);
	cout << result << endl;
	return 0;
}

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<string>
#include<functional>
#include<fstream>
#include<ctime>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> point;
typedef pair<int, int> pii;
const ll inf = 9.2e18;
const int maxn = 2507;
const int INF = 2.1e9;
const int MOD = 1e9 + 7;
const double dif = 1e-7;
const double PI = acos(-1.0);

int n, m, k;

int main(){
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int x1, x2, y1, y2;
	while (cin >> x1 >> y1 >> x2 >> y2){
		if (x1 == x2) cout << (abs(y2 - y1) - 1) + 8 << endl;
		else if (y1 == y2) cout << (abs(x2 - x1) - 1) + 8 << endl;
		else cout << 2 * (abs(x2 - x1) + abs(y2 - y1) + 2) << endl;
	}
	return 0;
}

#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int x,y,a,b;
	cin>>x>>y>>a>>b;
	cout<<2*(abs(x-a)+2+abs(y-b));

	//system("pause");
	//return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 1e8   + 7;

int a, b, c, d;

main()
{
    cin >> a >> b >> c >> d;
    if (a == c) {
        cout << abs(b - d) * 2 + 6;
    }
    if (b == d) {
        cout << abs(a - c) * 2 + 6;
    }
    else
        cout << (abs(a - b) + abs(c - d)) * 2 + 4;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int a, b, x, y, co;
    cin>>a>>b>>x>>y;
    co=abs(a-x)+abs(b-y);
    if(co>=2)
    cout<<co*2+4<<endl;
    else
    cout<<8<<endl;
}

#include <iostream>
using namespace std;
int main () {
	int x, y, x1, y1, count = 0, count1 = 0;
	cin>> x >> y >> x1 >> y1;
	if ( x < 0)
		x = x * (-1);
	if ( x1 < 0)
		x1 = x1 * (-1);
	if ( y < 0 )
		y = y * (-1);
	if ( y1 < 0 )
		y1 = y1 * (-1);
	if ( x > x1)
		count += ( x - x1 ) + 1;
	else
		count += ( x1 - x ) + 1;
	count *= 2;
	if ( y > y1 )
		count1 += ( y - y1 ) + 1;
	else
		count1 += ( y1 - y ) + 1;
	count1 *= 2;
	cout<< count+count1 << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int x1,y1,x2,y2;
  cin >> x1>>y1>>x2>>y2;
  x1 = abs(x1-x2);
  y1 = abs(y1-y2);
  if( x1==0 || y1==0)
     printf("%d",x1!=0 ? x1 : y1);
  else
     printf("%d",2*(x1+y1)+4);
  return 0;
}