#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
int loc=0;//刚开始电梯在第0层
int cost=0;
while(n--)
{
int x;
scanf("%d",&x);
if(x>loc)//下一步电梯的需求是在第x层,且高于当前层
cost+=(x-loc)*6+5;
else//下一步电梯的需求要低于当前层
cost+=(loc-x)*4+5;
loc=x;//电梯移动到了x的位置
}
printf("%d",cost);
return 0;
}