#include <bits/stdc++.h>
using namespace std;
const int N = 3e5;
const int INF = 1e9 + 9;
int n;
int og[N], a[N], d[N];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = int(1); i <= int(n); ++i) cin >> og[i];
  for (int i = int(2); i <= int(n - 1); ++i) {
    if (og[i] == og[i - 1]) a[i] = og[i] - 1;
    if (og[i] < og[i - 1]) {
      a[i] = og[i] - 1;
      a[i - 1] = min(a[i - 1], og[i]);
    }
    if (og[i] > og[i - 1]) a[i] = og[i - 1];
  }
  int ans = 0;
  for (int i = int(1); i <= int(n); ++i) {
    d[i] = a[i];
    d[i] = min(d[i], d[i - 1] + 1);
  }
  for (int i = int(n); i >= int(1); --i) {
    d[i] = min(d[i], d[i + 1] + 1);
    ans = max(ans, d[i]);
  }
  cout << ans + 1 << "\n";
  return 0;
}
