#include <bits/stdc++.h>
using namespace std;
void judge() { return; }
bool compare(long long int x, long long int y) { return x < y; }
long long int powerlong(long long int base, long long int exponent,
                        long long int modulus) {
  long long int k = 1;
  while (exponent) {
    if (exponent & 1 == 1) {
      k = (k * base) % modulus;
      exponent--;
      continue;
    }
    exponent = exponent / 2;
    base = (base * base) % modulus;
  }
  return k;
}
long long int modinvfermet(long long int a, long long int modulo) {
  a = a % modulo;
  return (powerlong(a, modulo - 2, modulo)) % modulo;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  judge();
  long long int t = 1;
  while (t--) {
    long long int i = 0, j = 0, k, l = 0, z = 0;
    long long int n, m = 0;
    long long int x = 0, y;
    cin >> n;
    long long int a[n];
    char c;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      m = max(m, a[i]);
    }
    m = min(m, (n + 1) / 2);
    long long int prev = a[0];
    a[0] = 0;
    for (i = 1; i < (n - 1); i++) {
      z = a[i];
      if (a[i] > min(prev, a[i + 1])) {
        a[i] = min(prev, a[i + 1]);
      } else if (a[i] <= min(prev, a[i + 1])) {
        a[i] = max(a[i] - 1, (long long int)0);
      }
      prev = z;
    }
    a[n - 1] = 0;
    y = INT_MAX;
    long long int curr = 0;
    vector<long long int> v(a, a + n);
    for (i = 1; i < n - 1; i++) {
      v[i] = min(a[i], curr + 1);
      if (a[i] == 0) {
        curr = 0;
        continue;
      }
      if (curr + 1 > v[i]) {
        curr = v[i];
      } else {
        curr++;
      }
    }
    long long int curr2 = 0;
    for (j = n - 2; j > 0; j--) {
      v[j] = min(v[j], curr2 + 1);
      if (v[j] == 0) {
        curr = 0;
        continue;
      }
      if (curr2 + 1 > v[j]) {
        curr2 = v[j];
      } else {
        curr2++;
      }
    }
    long long int res = 0;
    for (i = 1; i < n - 1; i++) {
      res = max(res, v[i]);
    }
    res = res + 1;
    cout << res << endl;
  }
}
