#include <bits/stdc++.h>
using namespace std;
int height[100060];
int f[100060][2];
int n;
int main() {
  memset(f, 0, sizeof(f));
  int ans = -1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &height[i]);
  f[1][1] = 1;
  f[n][0] = 1;
  for (int i = 2; i <= n; i++)
    if (height[i] <= height[i - 1])
      f[i][1] = (height[i] < f[i - 1][1] + 1 ? height[i] : f[i - 1][1] + 1);
    else
      f[i][1] = f[i - 1][1] + 1;
  for (int i = n - 1; i >= 1; i--)
    if (height[i] <= height[i + 1])
      f[i][0] = (height[i] < f[i + 1][0] + 1 ? height[i] : f[i + 1][0] + 1);
    else
      f[i][0] = f[i + 1][0] + 1;
  for (int i = 1; i <= n; i++)
    ans = (ans > (f[i][1] < f[i][0] ? f[i][1] : f[i][0])
               ? ans
               : (f[i][1] < f[i][0] ? f[i][1] : f[i][0]));
  printf("%d\n", ans);
  return 0;
}
