#include<cstdio>
#include<vector>
using namespace std;
int main(){
int N;
scanf("%d",&N);
vector<int> v(N+1);
v[0]=0;
int time=0;
for(int i=1;i<=N;i++){
scanf("%d",&v[i]);
if(v[i]>v[i-1])
time+=(v[i]-v[i-1])*6+5;
else if(v[i]<v[i-1])
time+=(v[i-1]-v[i])*4+5;
else if(v[i]==v[i-1])
time+=5;
}
printf("%d",time);
return 0;
}