#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int h[n];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  int wys[n][2];
  int rosnpr = 0;
  int rosnlw = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] > rosnpr) {
      rosnpr++;
      wys[i][0] = rosnpr;
    } else {
      rosnpr = h[i];
      wys[i][0] = rosnpr;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (h[i] > rosnlw) {
      rosnlw++;
      wys[i][1] = rosnlw;
    } else {
      rosnlw = h[i];
      wys[i][1] = rosnlw;
    }
  }
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    if (min(wys[i][0], wys[i][1]) > maxi) {
      maxi = min(wys[i][0], wys[i][1]);
    }
  }
  cout << maxi;
}
