Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.

Limak will repeat the following operation till everything is destroyed.

Block is called internal if it has all four neighbors, i.e. it has each side (top, left, down and right) adjacent to other block or to the floor. Otherwise, block is boundary. In one operation Limak destroys all boundary blocks. His paws are very fast and he destroys all those blocks at the same time.

Limak is ready to start. You task is to count how many operations will it take him to destroy all towers.

Input

The first line contains single integer n (1 ≤ n ≤ 105).

The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.

Output

Print the number of operations needed to destroy all towers.

Examples

Input

6
2 1 4 6 2 2


Output

3


Input

7
3 3 3 1 3 3 3


Output

2

Note

The picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. 

<image> After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
#include <bits/stdc++.h>
using namespace std;
char buf[1024];
int _bytes_read_ = 1024 - 1;
char *_s = buf + _bytes_read_;
inline char getc1() {
  if (_s >= buf + _bytes_read_) {
    _bytes_read_ = fread(buf, 1, 1024 - 1, stdin);
    buf[_bytes_read_] = 0;
    _s = buf;
  }
  return *(_s++);
}
inline int readint() {
  char t = getc1();
  int n = 1, res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = 10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline long long readLL() {
  char t = getc1();
  int n = 1;
  long long res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = (long long)10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline double readdouble() {}
inline char skipwhitespace() {
  char ch = getc1();
  while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') ch = getc1();
  return ch;
}
inline int readline(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline int readstr(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != ' ' && ch != '\t' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline char readchar() { return skipwhitespace(); }
char outbuf[1024];
int outbuf_p;
inline void putc1(char ch) {
  if (outbuf_p >= 1024) {
    fwrite(outbuf, 1, 1024, stdout);
    outbuf_p = 0;
  }
  outbuf[outbuf_p++] = ch;
}
inline void flush() {
  fwrite(outbuf, 1, outbuf_p, stdout);
  outbuf_p = 0;
}
inline void writeint(int n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[10];
  int i = 9;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 10) putc1(buf[i]);
}
inline void writeLL(long long n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[25];
  int i = 24;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 25) putc1(buf[i]);
}
inline void writestr(char *s) {
  char *p = s;
  while (*p) {
    putc1(*p);
    p++;
  }
}
inline void writedouble(double d, int p) {
  char buf[40];
  sprintf(buf, "%.*f", p, d);
  writestr(buf);
}
double my_sqrt(double x) {
  const double delta = .00001;
  double g = x / 2, ng;
  while (fabs(g - (ng = (x / g + g) / 2)) > delta) g = ng;
  return g;
}
vector<string> split(string S, string D) {
  vector<string> ar;
  int pos = 0, last = 0;
  while ((pos = S.find(D, last)) != string::npos) {
    ar.push_back(S.substr(last, pos - last));
    last = pos + D.length();
  }
  ar.push_back(S.substr(last));
  return ar;
}
inline long long pow(long long b, long long e) {
  long long ans = 1;
  while (e--) ans *= b;
  return ans;
}
inline long long pow1(long long b, long long e, long long mod) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * b % mod;
    b = b * b % mod;
    e >>= 1;
  }
  return ans;
}
inline long long pow(long long b, long long e, long long mod) {
  if (e < 0)
    return pow1(pow1(b, -e, mod), mod - 2, mod);
  else
    return pow1(b, e, mod);
}
template <class T>
T egcd(T a, T b, T &x, T &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T x1, y1;
  T d = egcd(b % a, a, x1, y1);
  x = y1 - x1 * (b / a);
  y = x1;
  return d;
}
long long inv(long long a, long long m) {
  long long inv, y;
  assert(egcd(a, m, inv, y) == 1);
  if (inv < 0) inv += m;
  return inv;
}
inline long long gcd(long long a, long long b) {
  while (b) {
    long long t = b;
    b = a % b;
    a = t;
  }
  return a;
}
vector<int> getfactors(int n) {
  vector<int> f;
  for (int a = 2; a * a <= n; a++) {
    int p = 1;
    while (n % a == 0) {
      n /= a;
      p *= a;
    }
    if (p > 1) f.push_back(p);
  }
  return f;
}
int main() {
  int n = readint();
  int ar[n], done[n], vis[n];
  memset(vis, 0, sizeof(int) * n);
  set<pair<int, int> > s;
  s.insert({1, 0});
  s.insert({1, n - 1});
  done[0] = done[n - 1] = 1;
  for (int a = 0; a < n; a++) {
    ar[a] = readint();
    if (a > 0 and a < n - 1) {
      s.insert({ar[a], a});
      done[a] = ar[a];
    }
  }
  while (!s.empty()) {
    auto i = *s.begin();
    int cost = i.first, pos = i.second;
    vis[pos] = 1;
    s.erase(s.begin());
    if (pos - 1 >= 0 and !vis[pos - 1] and done[pos] + 1 < done[pos - 1]) {
      auto it = s.find({done[pos - 1], pos - 1});
      assert(it != s.end());
      if (it != s.end()) s.erase(it);
      done[pos - 1] = min(done[pos - 1], cost + 1);
      s.insert({done[pos - 1], pos - 1});
    }
    if (pos + 1 < n and !vis[pos + 1] and done[pos] + 1 < done[pos + 1]) {
      auto it = s.find({done[pos + 1], pos + 1});
      assert(it != s.end());
      if (it != s.end()) s.erase(it);
      done[pos + 1] = min(done[pos + 1], cost + 1);
      s.insert({done[pos + 1], pos + 1});
    }
  }
  int ans = 0;
  for (int a = 0; a < n; a++) ans = max(ans, done[a]);
  printf("%d\n", ans);
  return 0;
}
