#include <stdio.h>
#include <math.h>
int main(void)
{
int n;
scanf("%d", &n);
int matrix[n][2];
for(int i = 0; i < n; i++)
{
for(int j = 0; j < 2; j++)
{
scanf("%d", &matrix[i][j]);
}
}
int step = 0;
int old_x = 0;
int old_y = 0;
for(int i = 0; i < n; i++)
{
int new_x = matrix[i][0];
int new_y = matrix[i][1];
if(new_x != old_x)
{
step += fabs((new_x - old_x) * 1.0);
}
if(new_y != old_y)
{
step += fabs((new_y - old_y) * 1.0);
}
old_x = new_x;
old_y = new_y;
}
step += fabs(1.0 * old_x) + fabs(1.0 * old_y);
printf("%d", step);
return 0;
}