#include <iostream>
#define ll long long
using namespace std;
ll a[62],b[62];
int typ[62];
ll y1,x1,y2,x2;
ll ry1,rx1,ry2,rx2;
ll dist(ll yeka, ll xeka, ll ytoka, ll xtoka) {
if (yeka < ytoka) swap(yeka,ytoka);
if (xeka<xtoka) swap(xeka,xtoka);
return (yeka-ytoka) + (xeka-xtoka);
}
int contain(ll alay, ll alax, ll ylay, ll ylax, ll y, ll x) {
if (alay>ylay) swap(alay,ylay);
if (alax>ylax) swap(alax,ylax);
if (y<alay || y>ylay) return 0;
if (x<alax || x>ylax) return 0;
return 1;
}
void findrect(int ind, int cor){
if (cor){
if (typ[ind]==0) {
ry1=a[ind]+1;
rx1=b[ind]+1;
ry2=a[ind+4]-1;
rx2=b[ind+4]-1;
} else if (typ[ind]==1) {
ry1=a[ind]-1;
rx1=b[ind]+1;
ry2=a[ind+4]+1;
rx2=b[ind+4]-1;
} else if (typ[ind]==2) {
ry1=a[ind]-1;
rx1=b[ind]-1;
ry2=a[ind+4]+1;
rx2=b[ind+4]+1;
} else {
ry1=a[ind]+1;
rx1=b[ind]-1;
ry2=a[ind+4]-1;
rx2=b[ind+4]+1;
}
} else {
if (typ[ind]==0) {
ry1=a[ind];
rx1=b[ind]+1;
ry2=a[ind+1];
rx2=b[ind+4]-1;
} else if (typ[ind]==1) {
ry1=a[ind]-1;
rx1=b[ind];
ry2=a[ind+4]+1;
rx2=b[ind+1];
} else if (typ[ind]==2) {
ry1=a[ind];
rx1=b[ind]-1;
ry2=a[ind+1];
rx2=b[ind+4]+1;
} else {
ry1=a[ind]+1;
rx1=b[ind];
ry2=a[ind+4]-1;
rx2=b[ind+1];
}
}
}
ll advance(int ind,int cor) {
ll hlp1,hlp2;
if (typ[ind]==0) {
hlp1=a[ind+(!cor)]-(!cor);
hlp2=x1;
} else if (typ[ind]==1) {
hlp1=y1;
hlp2=b[ind+(!cor)]-(!cor);
} else if (typ[ind]==2) {
hlp1=a[ind+(!cor)]+(!cor);
hlp2=x1;
} else {
hlp1=y1;
hlp2=b[ind+(!cor)]+(!cor);
}
ll ret = dist(y1,x1,hlp1,hlp2);
y1=hlp1;
x1=hlp2;
return ret;
}
int main() {
cin >> y1 >> x1 >> y2 >> x2;
if (contain(-3,-5,0,1,y1,x1) && contain(-3,-5,0,1,y2,x2)) {
cout << dist(y1,x1,y2,x2) << "\n";
return 0;
}
ll sel = 0;
a[0]=0;
b[0]=0;
typ[0]=3;
for (ll i=1;i<=60;i++) {
if (sel%2) {
b[i]=b[i-1];
a[i]=a[i-1]+(2*((sel/2)%2)-1)*(((ll)1)<<i);
} else {
a[i]=a[i-1];
b[i]=b[i-1]+(1-2*((sel/2)%2))*(((ll)1)<<i);
}
typ[i]=sel;
sel++;
sel%=4;
}
int found=0;
ll res = 0;
if (contain(-3,-5,0,1,y2,x2)) {
swap(y1,y2);
swap(x1,x2);
}
if (contain(-3,-5,0,1,y1,x1)) {
found=1;
ll hlp = min(x1,(ll)(-1));
res+=dist(y1,x1,1,hlp);
y1=1;
x1=hlp;
}
int cor=1;
int ind = 0;
while (!found) {
findrect(ind,cor);
if (contain(ry1,rx1,ry2,rx2,y2,x2)) {
swap(y1,y2);
swap(x1,x2);
}
if (contain(ry1,rx1,ry2,rx2,y1,x1)) {
found=1;
continue;
}
cor = !cor;
if (cor) ind++;
}
while (1) {
findrect(ind,cor);
if (contain(ry1,rx1,ry2,rx2,y2,x2)) {
res+=dist(y1,x1,y2,x2);
cout << res << "\n";
return 0;
}
res+=advance(ind,cor);
cor=!cor;
if (cor) ind++;
}
}