#include <bits/stdc++.h>
using namespace std;
int n, seg[1 << 18], lazy[1 << 18], ans;
void update(int node) {
  if (lazy[node]) {
    seg[node] += lazy[node];
    if (node < (1 << 17)) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
}
int mx(int node, int l, int r, int L, int R) {
  if (L >= r || R <= l) return 1000000000;
  update(node);
  if (L >= l && R <= r) return seg[node];
  return min(mx(node * 2, l, r, L, (R + L) / 2),
             mx(node * 2 + 1, l, r, (L + R) / 2, R));
}
void move(int node, int l, int r, int L, int R, int val) {
  if (L >= r || R <= l) return;
  if (L >= l && R <= r) {
    lazy[node] += val;
    return;
  }
  update(node);
  move(node * 2, l, r, L, (L + R) / 2, val);
  move(node * 2 + 1, l, r, (L + R) / 2, R, val);
  update(node * 2 + 1);
  update(node * 2);
  seg[node] = min(seg[node * 2], seg[node * 2 + 1]);
}
int main() {
  cin >> n;
  seg[1 << 17] = 1;
  seg[(1 << 17) + n + 1] = n;
  for (int i = 0; i < n; i++) {
    cin >> seg[i + (1 << 17) + 1];
    seg[i + (1 << 17) + 1] += i;
  }
  for (int i = n + 2; i < (1 << 17); i++) {
    seg[i + (1 << 17)] = 1000000000;
  }
  for (int i = (1 << 17) - 1; i > 0; i--) {
    seg[i] = min(seg[i * 2], seg[i * 2 + 1]);
  }
  for (int i = 1; i <= n; i++) {
    ans = max(ans, mx(1, 0, 1 << 17, 0, 1 << 17));
    move(1, 0, i + 1, 0, 1 << 17, 1);
    move(1, i + 1, 1 << 17, 0, 1 << 17, -1);
  }
  cout << ans;
}
