#include <iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
int f[5001]={1};
for(int i=1; i<=n; i++) cin>>f[i];
int pc=0;
for(int i=1; i<=n; i++)
{
if(f[i]>f[i-1]) pc+=(f[i]-f[i-1])*3;
else pc+=(f[i-1]-f[i])*2;
}
cout<<pc<<endl;
}
}