#include <bits/stdc++.h>
using namespace std;
set<long long>::iterator it;
vector<long long>::iterator it1;
struct stc {
  int fir, sc;
} input[1000];
bool comp(stc a, stc b) { return a.fir < b.fir; }
long long bl[100010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long b, i, n, opr, mn, k;
  while (cin >> n) {
    for (i = 1; i <= n; i++) {
      cin >> bl[i];
    }
    opr = 0;
    bl[0] = bl[n + 1] = 0;
    for (i = 1; i <= n; i++)
      bl[i] = (bl[i] < (bl[i - 1] + 1 < bl[i + 1] + 1 ? bl[i - 1] + 1
                                                      : bl[i + 1] + 1)
                   ? bl[i]
                   : (bl[i - 1] + 1 < bl[i + 1] + 1 ? bl[i - 1] + 1
                                                    : bl[i + 1] + 1));
    for (i = n; i >= 1; i--) {
      bl[i] = (bl[i] < (bl[i - 1] + 1 < bl[i + 1] + 1 ? bl[i - 1] + 1
                                                      : bl[i + 1] + 1)
                   ? bl[i]
                   : (bl[i - 1] + 1 < bl[i + 1] + 1 ? bl[i - 1] + 1
                                                    : bl[i + 1] + 1));
      opr = (opr > bl[i] ? opr : bl[i]);
    }
    cout << opr << endl;
  }
  return 0;
}
