#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 1e5 + 10;
const long long inf = 1e14;
vector<pair<long long, long long> > graph[MAX_SIZE];
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
vector<long long> dist(MAX_SIZE);
int n;
void dijkstra(int s) {
  for (int i = 0; i <= n + 1; i++) dist[i] = inf;
  dist[s] = 0;
  pq.push({0, s});
  while (!pq.empty()) {
    int u = pq.top().second;
    pq.pop();
    for (auto &e : graph[u]) {
      int v = e.first;
      long long w = e.second;
      if (dist[v] > w + dist[u]) {
        dist[v] = w + dist[u];
        pq.push({dist[v], v});
      }
    }
  }
}
int main() {
  long long h;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> h;
    graph[n + 2].push_back({i, h});
  }
  graph[n + 2].push_back({0, 0});
  graph[n + 2].push_back({n + 1, 0});
  for (int i = 1; i <= n + 1; i++) {
    graph[i].push_back({i - 1, 1});
    graph[i - 1].push_back({i, 1});
  }
  dijkstra(n + 2);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, dist[i]);
  }
  cout << ans << endl;
  return 0;
}
