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 h_{i} 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 ≤ 10^5).

The second line contains n space-separated integers h_1, h_2, ..., h_{n} (1 ≤ h_{i} ≤ 10^9) — 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.

Difficulty: competition

Starter code:

Solutions:

x = int(input())
y = list(map(int, input().split(' ')))

y[0] = 1
y[x-1] = 1

z = y[:]
for i in range(1, x):
    z[i] = min(z[i], z[i-1] + 1)

w = y[:]
for i in range(x-2, -1, -1):
    w[i] = min(w[i], w[i+1]+1)

ans = 0
for i in range(x):
    ans = max(ans, min(z[i], w[i]))

print(ans)


input()
l, r = [0], [0]
for a, b in (lambda a: list(zip(a, reversed(a))))([0] + list(map(int, input().split())) + [0]):
    l.append(min(a, l[-1] + 1))
    r.append(min(b, r[-1] + 1))
print(max(list(map(min, list(zip(l[1:], reversed(r[1:])))))))


#CLown1331 -_-
n = int(input())
ar = list(map(int,input().split()))
r = []
l = []
day = 0
for i in ar:
    day += 1
    day = min(i,day)
    l.append(day)
day = 0
for i in reversed(ar):
    day += 1
    day = min(i,day)
    r.append(day)
ans = 0
x = 0
rh = list(reversed(r))
while x < n:
    ans = max(ans,min(rh[x],l[x]))
    x += 1
print (ans)

#CLown1331 -_-
n = int(input())
ar = list(map(int,input().split()))
r = []
l = []
day = 0
for i in ar:
    day += 1
    day = min(i,day)
    l.append(day)
day = 0
for i in reversed(ar):
    day += 1
    day = min(i,day)
    r.append(day)
ans = 0
x = 0
rh = list(reversed(r))
while x < n:
    ans = max(ans,min(rh[x],l[x]))
    x += 1
print (ans)

#CLown1331 -_-
n = int(input())
ar = list(map(int,input().split()))
r = []
l = []
day = 0
for i in ar:
    day += 1
    day = min(i,day)
    l.append(day)
day = 0
for i in reversed(ar):
    day += 1
    day = min(i,day)
    r.append(day)
ans = 0
x = 0
kk = n-1
while x < n:
    ans = max(ans,min(r[kk],l[x]))
    x += 1
    kk -= 1
print (ans)


import sys
try:
    while True:
        n = int(input())
        height = list(map(int, input().split(" ")))
        L = [0 for i in range(100001)]
        R = [0 for i in range(100001)]
        for i in range(n):
            L[i+1] = min(L[i]+1, height[i])
        for i in range(n-1, -1, -1):
            R[i] = min(R[i+1]+1, height[i])
        ans = 0
        for i in range(1, n+1):
            ans = max(ans, min(R[i-1], L[i]))
        print(ans)
except EOFError:
    pass

def main():
    input()
    hh = list(map(int, input().split()))
    for f in True, False:
        m = 1
        for i, h in enumerate(hh):
            if h > m:
                hh[i] = m
            else:
                m = h
            m += 1
        if f:
            hh.reverse()
    print(max(hh))


def __starting_point():
    main()

__starting_point()

input()
def f(l):
    c = [0]*len(l)
    c[0] = c[len(c) - 1] = 9999999
    for item in range(1, len(l) - 1):
        c[item] = min(item, l[item], c[item - 1] + 1)
    for item in reversed(list(range(1, len(l) - 1))):
        c[item] = min(c[item], len(l) - 2 + 1 - item, c[item + 1] + 1)

    return max(c[1:-1])

print(f([0] + list(map(int, input().split())) + [0]))



from sys import stdin as si
from collections import Counter as c


class Solution:

    def bazinga(self,n ,m):
        m[0]=1
        for i in range(1,n-1):
            m[i] = min(m[i - 1]+1, m[i], i + 1)
        m[n-1]=1
        for i in range(n - 2, -1, -1):
            m[i] = min(m[i], m[i + 1] +1)

        return(max(m))


def __starting_point():
    #for i in range(int(si.readline().strip())):
    n = int(si.readline().strip())
    #n,m = map(int, si.readline().strip().split())
    m = list(map(int, si.readline().strip().split()))
    S = Solution()
    print(S.bazinga(n,m))


'''
http://codeforces.com/contest/573/problem/B
'''
__starting_point()

R = lambda: map(int, input().split())

n = int(input())
arr = [-1] + list(R()) + [-1]
dpl, dpr = arr[:], arr[:]
for i in range(1, n + 1):
    dpl[i] = max(0, min(dpl[i - 1] + 1, arr[i] - 1))
for i in range(n, 0, -1):
    dpr[i] = max(0, min(dpr[i + 1] + 1, arr[i] - 1))
print(1 + max(min(l, r) for l, r in zip(dpl, dpr)))

n = (int)(input())

h = list(map(int,input().split()))

dp = []

dp.append(1)

for i in range(1,n-1,1):

    dp.append(min(dp[i-1]+1,h[i]))

dp.append(1)

for i in range(n-2,0,-1):

    dp[i]=min(dp[i],dp[i+1]+1)

mx=-1

for i in range(n):

    mx=max(mx,dp[i])

print(mx)





# Made By Mostafa_Khaled


def powmod(x, p, m):
	if p <= 0:
		return 1
	if p <= 1:
		return x%m
	return powmod(x*x%m, p//2, m) * (x%m)**(p%2) % m

###

n = int(input())
#print(n)
h = [0] + [int(x) for x in input().split()] + [0]
#print(h)

for i in range(1, len(h)):
	h[i] = min(h[i], h[i-1]+1)
	h[-i-1] = min(h[-i-1], h[-i]+1)

#print(h)
ans = max(h)
print(ans)






































































































n = int(input())
a = [int(x) for x in input().split()]

a[0] = 1
a[-1] = 1
for i in range(1,n):
    a[i] = min(a[i],a[i-1]+1)
    a[-i] = min(a[-i],a[-(i-1)]+1)

print(max(a))



n = int(input())
a = [int(x) for x in input().split()]
 
a[0] = 1
a[-1] = 1

for i in range(1, n):
    a[i] = min(a[i], a[i-1]+1)
    a[-i] = min(a[-i], a[-(i-1)]+1)
 
print(max(a))

# -*- coding:utf-8 -*-

"""

created by shuangquan.huang at 1/9/20

"""

import collections
import time
import os
import sys
import bisect
import heapq
from typing import List


def check(H, N, K):
    for i in range(K+1, N-K+1):
        h = H[i]
        for j in range(K+1):
            if h <= 0:
                break
            if i - j >= 0:
                h = min(h, H[i-j] - (K - j))
            if i + j <= N:
                h = min(h, H[i + j] - (K - j))
        if h > 0:
            return False
    return True


def solve2(N, A):
    A = [0] + A + [0]
    lo, hi = 0, N // 2 + 1
    while lo <= hi:
        k = (lo + hi) // 2
        if check(A, N, k):
            hi = k - 1
        else:
            lo = k + 1
    return lo
    

def solve(N, A):
    A = [0] + A + [0]
    H = [N] * (N+2)
    H[0] = H[-1] = 0
    worst = 0
    for i in range(1, N+1):
        worst = min(worst, A[i] - i)
        H[i] = i + worst
        # k = min([A[i-j] + j for j in range(i+1)])
        # H[i] = min(H[i], k)
    worst = N+1
    for i in range(N, 0, -1):
        worst = min(worst, A[i] + i)
        H[i] = min(H[i], worst - i)
        # k = min([A[i+j] + j for j in range(N-i+1)])
        # H[i] = min(H[i], k)
    # print(H)
    return max(H)
    
    
    

# import random
# N = 10 ** 5
# A = [random.randint(0, 10**9) for _ in range(N)]
# t0 = time.time()
# print('starting...')
# solve(N, A)
# print(time.time() - t0)
# N = 10**5
# A = [i+1 for i in range(N)] + [N+1] + [N-i for i in range(N)]
# t0 = time.time()
# print(solve(2*N+1, A))
# print(time.time() - t0)

N = int(input())
A = [int(x) for x in input().split()]
print(solve(N, A))

from pprint import pprint
import sys
#sys.setrecursionlimit(100000)
input = sys.stdin.readline

n = int(input())
dat = list(map(int, input().split()))

datl = [-1] * n
datr = [-1] * n
res = [-1] * n
for i in range(n):
    datl[i] = min(i + 1, dat[i])
    if i > 0:
        datl[i] = min(datl[i], datl[i - 1] + 1)

for i in range(n):
    datr[n-1-i] = min(i + 1, dat[n-1-i] )
    if i > 0:
        datr[n - 1 - i] = min(datr[n - 1 - i], datr[n - 1 - i + 1] + 1)

for i in range(n):
    res[i] = min(datl[i], datr[i])

print(max(res))


from pprint import pprint
import sys
#sys.setrecursionlimit(100000)
input = sys.stdin.readline

n = int(input())
dat = list(map(int, input().split()))

datl = [-1] * n
datr = [-1] * n
res = [-1] * n
for i in range(n):
    datl[i] = min(i + 1, dat[i])
    if i > 0:
        datl[i] = min(datl[i], datl[i - 1] + 1)

for i in range(n):
    datr[n-1-i] = min(i + 1, dat[n-1-i] )
    if i > 0:
        datr[n - 1 - i] = min(datr[n - 1 - i], datr[n - 1 - i + 1] + 1)

for i in range(n):
    res[i] = min(datl[i], datr[i])

print(max(res))



def main():
    n = int(input())
    hts = list(map(int,input().split()))
    dpleft = [1]
    for i in range(1,n):
        dpleft.append(min(hts[i],dpleft[-1]+1))

    hts.reverse()
    dpright = [1]
    for i in range(1,n):
        dpright.append(min(hts[i],dpright[-1]+1))

    dpright.reverse()
    ans = 0
    for i in range(n):
        ans = max(ans,min(dpleft[i],dpright[i]))

    print(ans)

main()


 
n = int(input())
a = [int(x) for x in input().split()]
 
a[0] = 1
a[-1] = 1
for i in range(1,n):
    a[i] = min(a[i],a[i-1]+1)
    a[-i] = min(a[-i],a[-(i-1)]+1)
 
print(max(a))


from math import inf
n = int(input())
l = [int(i) for i in input().split()]
l.append(0)
l.insert(0,0)
minus = [v-i for i,v in enumerate(l)]
plus  = [v+i for i,v in enumerate(l)]

lminus,rplus = [minus[0]],[plus[-1]]
for i in range(1,n+1):
    lminus.append(min(lminus[-1],minus[i]))
lminus.append(inf)

for i in range(n, 0, -1):
    rplus.append( min(rplus[-1], plus[i]))
rplus.append(inf)
rplus.reverse()
m = 0

for i in range(1, n+1):
    x  = min(lminus[i]+i, rplus[i]-i)
    m = max(m, x)
print(m)