#include using namespace std; #define rep(i,a,b) for(int i=a;i=b;i--) typedef long long ll; int N; ll A[2010]; //----------------------------------------------------------------- ll sol(int i) { ll t = -1; rep(j, 0, N) { if (j < i) { t = max(t + 1, A[j]); } else { t++; } } rrep(j, N - 1, i) { t = max(t + 1, A[j]); } ll s = -1; rep(j, 0, N) s = max(s + 1, A[j]); t = min(s, t); return t; } //----------------------------------------------------------------- int main() { cin >> N; rep(i, 0, N) scanf("%lld", &A[i]); ll ans = 1LL << 60; rep(i, 0, N) ans = min(ans, sol(i)); reverse(A, A + N); rep(i, 0, N) ans = min(ans, sol(i)); cout << ans << endl; }