#include <bits/stdc++.h>
using namespace std;
const int lim = 100005;
int s[lim];
int d[lim];
int m, ans;
int main() {
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &s[i]);
  }
  for (int i = 1; i <= m; i++) {
    if (s[i] == 0) {
      d[i] = 0;
    } else if (s[i] >= s[i - 1]) {
      d[i] = d[i - 1] + 1;
    } else {
      d[i] = min(s[i], d[i - 1] + 1);
    }
    d[i] = min(d[i], s[i]);
  }
  for (int i = m; i >= 1; i--) {
    if (s[i] == 0) {
      d[i] = 0;
    }
    if (s[i] >= s[i + 1]) {
      d[i] = min(d[i + 1] + 1, d[i]);
    } else {
      d[i] = min(d[i], d[i + 1] + 1);
    }
  }
  for (int i = 1; i <= m; i++) {
    ans = max(ans, d[i]);
  }
  cout << ans << endl;
  return 0;
}
