#include <iostream>
using namespace std;
int main(){
int a[200]={0};
int n=0;
int sum =0;
int tmp=0;
int count=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]>tmp){
sum += (a[i]-tmp)*6;
tmp = a[i];
//count++;
}else if(tmp>a[i]){
sum += (tmp-a[i])*4;
tmp = a[i];
// count++;
}
}
sum += n*5;
cout<<sum<<endl;
return 0;
}
这道题有点奇怪,当它连续出现同一个数字时,会在那一层停留多次