#include <bits/stdc++.h>
using namespace std;
std::ostream& operator<<(std::ostream& os, pair<int, int> p) {
  os << p.first << ", " << p.second;
  return os;
}
const int MAXN = 2 * 1e5 + 5;
int main() {
  int n;
  cin >> n;
  long long int cvb = 0;
  vector<pair<long long int, long long int> > vals;
  vals.push_back(pair<long long int, long long int>(0, 0));
  vals.push_back(pair<long long int, long long int>(0, n + 1));
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    vals.push_back(pair<long long int, long long int>(a, i + 1));
  }
  sort(vals.begin(), vals.end());
  set<pair<long long int, long long int> > times;
  times.insert(pair<long long int, long long int>(0, 0));
  times.insert(pair<long long int, long long int>(n + 1, 0));
  for (int i = 2; i <= n + 1; i++) {
    pair<long long int, long long int> vnow = vals[i];
    auto ustp =
        times.lower_bound(pair<long long int, long long int>(vnow.second, -1));
    auto altp = ustp;
    altp--;
    pair<long long int, long long int> ust = *ustp;
    pair<long long int, long long int> alt = *altp;
    long long int lcb = min(vnow.first, ust.second + ust.first - vnow.second);
    lcb = min(lcb, alt.second - alt.first + vnow.second);
    cvb = max(cvb, lcb);
    times.insert(pair<long long int, long long int>(vnow.second, lcb));
  }
  cout << cvb << "\n";
  return 0;
}
