/**

 *    author:  orzvanh14

 *    created: 23.12.2022 10:08:02

 *    too lazy to update time

**/

// i wants to take ioi

//binhtinhtutinkhongcaycunhungmotkhikhongcontutinnualatuyetvong

#include <bits/stdc++.h>

using namespace std;

#define int long long

#define nn "\n"

#define pi pair<int, int>

#define fi first

#define se second

#define lb lower_bound

#define ub upper_bound

#define eb emplace_back

#define pb push_back

#define TASK " "

#define ms(a, x) memset(a, x, sizeof(a))

#define all(a) a.begin(), a.end()

#define All(a, n) a + 1, a + 1 + n

#define LOG 19

const int INF = 1e18;

const int mod = 1e3+7;

const int N = 305;

const int maxN = 1e5 + 5;

int MOD = 998244353;

int bit[200000];

int n;

int a[N];

int dp[N][N];

void nhap(){

	cin >> n;
	for(int i = 1; i <= n - 1; i++){
		cin >> a[i];
	}

}

void solve(){

	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= n; j++){
			dp[i][j] = INF;
		}
	}
	dp[0][1] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 1; j <= n; j++){
			if(dp[i][j] == INF) continue;
			if(i + j >= n){
				dp[n][j] = min(dp[n][j], dp[i][j]);
			}
			for(int k = i + 1; k <= min(n - 1, i + j); k++){
				dp[k][j] = min(dp[k][j], dp[i][j] + 1);
				if(j + 1 <= n){
					dp[k][j + 1] = min(dp[k][j + 1],
						dp[i][j] + a[k] + 1);
				}
			}
		}
	}
	int ans = INF;
	for(int j = 1; j <= n; j++){
		ans = min(ans, dp[n][j]);
	}
	cout << ans << nn;

}

signed main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	nhap();
	solve();
	return (0 ^ 0);
}
