#include<iostream>
using namespace std;
int main(){
int N;
cin >> N;
int a[N] = {};
int times = 0;
for(int i = 0; i < N; i++){
    cin >> a[i];
}
for(int i = 0; i < N; i++){
    if(a[i] < a[i + 1]) times++;
}
cout << times * 2 + 4;
return 0;
}
