import java.io.*;
import java.util.*;

public class D {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		int nbB = sc.nextInt();
		int[] h = new int[nbB];
		for (int i = 0; i < nbB; i++) {
			h[i] = sc.nextInt();
		}
		int best = 1;
		for (int i = 0; i < nbB; i++) {
			int initialHeight = Math.min(h[i], Math.min(i + 1, nbB - i));
			int neededToBeFound = initialHeight - 1;
			int distanceToTop = 1;
			while (neededToBeFound >= 2) {
				int diff = h[i + distanceToTop] - neededToBeFound;
				diff = Math.min(h[i - distanceToTop] - neededToBeFound, diff);
				diff = Math.min(0, diff);
				initialHeight += diff;
				neededToBeFound += diff;
				neededToBeFound--;
				distanceToTop++;
			}
			if (initialHeight > best) {
				best = initialHeight;
			}
		}
		System.out.println(best);
	}

	// -----------MyScanner class for faster input thx Flatfoot----------
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (this.st == null || !this.st.hasMoreElements()) {
				try {
					this.st = new StringTokenizer(this.br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return this.st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = this.br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	// --------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class D {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		int nbB = sc.nextInt();
		int[] h = new int[nbB];
		for (int i = 0; i < nbB; i++) {
			h[i] = sc.nextInt();
		}
		int best = 1;
		for (int i = 0; i < nbB; i++) {
			int initialHeight = Math.min(h[i], Math.min(i + 1, nbB - i));
			int neededToBeFound = initialHeight - 1;
			if (neededToBeFound <= best) {
				continue;
			}
			int distanceToTop = 1;
			while (neededToBeFound >= 2) {
				int diff = h[i + distanceToTop] - neededToBeFound;
				diff = Math.min(h[i - distanceToTop] - neededToBeFound, diff);
				diff = Math.min(0, diff);
				if (diff < 0) {
					initialHeight += diff;
					neededToBeFound += diff;
					if (neededToBeFound <= best) {
						break;
					}
				}
				neededToBeFound--;
				distanceToTop++;
			}
			if (initialHeight > best) {
				best = initialHeight;
			}
		}
		System.out.println(best);
	}

	// -----------MyScanner class for faster input thx Flatfoot----------
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (this.st == null || !this.st.hasMoreElements()) {
				try {
					this.st = new StringTokenizer(this.br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return this.st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = this.br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	// --------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class D {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		int nbB = sc.nextInt();
		int[] height = new int[nbB];
		// we don't care of the first value
		sc.nextInt();

		for (int i = 1; i < nbB; i++) {
			int input = sc.nextInt();
			height[i] = min(input, height[i - 1] + 1, nbB - i);
			int distanceToPrevToCheck = 1;
			while (height[i] + distanceToPrevToCheck < height[i - distanceToPrevToCheck]) {
				height[i - distanceToPrevToCheck] = height[i] + distanceToPrevToCheck;
				distanceToPrevToCheck++;
			}

		}
		int max = 1;
		for (int i = 1; i < nbB; i++) {
			if (height[i] > max) {
				max = height[i];
			}
		}
		System.out.println(max);

	}

	private static int min(int input, int i, int j) {
		return Math.min(input, Math.min(i, j));
	}

	// -----------MyScanner class for faster input thx Flatfoot----------
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (this.st == null || !this.st.hasMoreElements()) {
				try {
					this.st = new StringTokenizer(this.br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return this.st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = this.br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	// --------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class D {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		int nbB = sc.nextInt();
		int[] h = new int[nbB];
		for (int i = 0; i < nbB; i++) {
			h[i] = sc.nextInt();
		}
		int best = 1;
		for (int i = 0; i < nbB; i++) {
			int initialHeight = Math.min(h[i], Math.min(i + 1, nbB - i));
			int neededToBeFound = initialHeight - 1;
			if (initialHeight <= best) {
				continue;
			}
			int distanceToTop = 1;
			while (neededToBeFound >= 2) {
				int diff = h[i + distanceToTop] - neededToBeFound;
				diff = Math.min(h[i - distanceToTop] - neededToBeFound, diff);
				diff = Math.min(0, diff);
				if (diff < 0) {
					initialHeight += diff;
					neededToBeFound += diff;
					if (initialHeight <= best) {
						break;
					}
				}
				neededToBeFound--;
				distanceToTop++;
			}
			if (initialHeight > best) {
				best = initialHeight;
			}
		}
		System.out.println(best);
	}

	// -----------MyScanner class for faster input thx Flatfoot----------
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (this.st == null || !this.st.hasMoreElements()) {
				try {
					this.st = new StringTokenizer(this.br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return this.st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = this.br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	// --------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class D {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		int nbB = sc.nextInt();
		int max = 1;
		int maxIndex = 0;
		// we don't care of the first value
		sc.nextInt();
		int prev = 1;
		for (int i = 1; i < nbB; i++) {
			int input = sc.nextInt();
			int current = min(input, prev + 1, nbB - i);
			if (current > max) {
				max = current;
				maxIndex = i;
			} else if (current < prev - 1) {
				int allowedDiff = i - maxIndex;
				max = Math.min(max, current + allowedDiff);
			}
			prev = current;
		}
		System.out.println(max);
	}

	private static int min(int input, int i, int j) {
		return Math.min(input, Math.min(i, j));
	}

	// -----------MyScanner class for faster input thx Flatfoot----------
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (this.st == null || !this.st.hasMoreElements()) {
				try {
					this.st = new StringTokenizer(this.br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return this.st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = this.br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	// --------------------------------------------------------
}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Random;
import java.util.StringTokenizer;

public class D
{
	public static final Random RANDOM = new Random(System.currentTimeMillis());
	private BufferedReader bufferedReader;
	private StringTokenizer stringTokenizer;
	private PrintWriter printWriter;

	public D()
	{
		this(new BufferedReader(new InputStreamReader(System.in)));
	}

	public D(BufferedReader bufferedReader)
	{
		this.bufferedReader = bufferedReader;
		this.stringTokenizer = null;
		this.printWriter = new PrintWriter(new BufferedOutputStream(System.out));
	}

	public D(String file) throws FileNotFoundException
	{
		this(new BufferedReader(new InputStreamReader(new FileInputStream(file))));
	}

	private String next() throws IOException
	{
		while ((this.stringTokenizer == null) || (!this.stringTokenizer.hasMoreTokens()))
		{
			this.stringTokenizer = new StringTokenizer(this.bufferedReader.readLine());
		}
		return stringTokenizer.nextToken();
	}

	public int nextInt() throws IOException
	{
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException
	{
		return Double.parseDouble(next());
	}

	public long nextLong() throws IOException
	{
		return Long.parseLong(next());
	}

	public String nextLine() throws IOException
	{
		return this.bufferedReader.readLine();
	}

	public void close()
	{
		printWriter.close();
	}

	public static void main(String[] args)
	{
		D template = new D();
		try
		{
			template.solve();
		}
		catch (IOException exception)
		{
			exception.printStackTrace();
		}
		template.close();
	}

	public static int[] destroy(int[] h)
	{
		int[] result = new int[h.length];
		for (int index = 0; index < h.length; index++)
		{
			if (h[index] > 0)
			{
				int internal = h[index] - 1;
				if (index > 0)
				{
					internal = Math.min(internal, h[index - 1]);
				}
				else
				{
					internal = 0;
				}
				if (index < h.length - 1)
				{
					internal = Math.min(internal, h[index + 1]);
				}
				else
				{
					internal = 0;
				}
				result[index] = internal;
			}
		}
		return result;
	}

	public static boolean destroyed(int[] h)
	{
		boolean result = true;
		for (int index = 0; index < h.length; index++)
		{
			result &= h[index] == 0;
		}
		return result;
	}

	public static int solve(int n, int[] h)
	{
		int result = 0;
		while (!destroyed(h))
		{
			result += 1;
			h = destroy(h);
		}
		return result;
	}

	public void solve() throws IOException
	{
		int n = nextInt();
		int[] h = new int[n];
		for (int index = 0; index < n; index++)
		{
			h[index] = nextInt();
		}
		this.printWriter.println(solve(n, h));
	}
}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Random;
import java.util.StringTokenizer;

public class D
{
	public static final Random RANDOM = new Random(System.currentTimeMillis());
	private BufferedReader bufferedReader;
	private StringTokenizer stringTokenizer;
	private PrintWriter printWriter;

	public D()
	{
		this(new BufferedReader(new InputStreamReader(System.in)));
	}

	public D(BufferedReader bufferedReader)
	{
		this.bufferedReader = bufferedReader;
		this.stringTokenizer = null;
		this.printWriter = new PrintWriter(new BufferedOutputStream(System.out));
	}

	public D(String file) throws FileNotFoundException
	{
		this(new BufferedReader(new InputStreamReader(new FileInputStream(file))));
	}

	private String next() throws IOException
	{
		while ((this.stringTokenizer == null) || (!this.stringTokenizer.hasMoreTokens()))
		{
			this.stringTokenizer = new StringTokenizer(this.bufferedReader.readLine());
		}
		return stringTokenizer.nextToken();
	}

	public int nextInt() throws IOException
	{
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException
	{
		return Double.parseDouble(next());
	}

	public long nextLong() throws IOException
	{
		return Long.parseLong(next());
	}

	public String nextLine() throws IOException
	{
		return this.bufferedReader.readLine();
	}

	public void close()
	{
		printWriter.close();
	}

	public static void main(String[] args)
	{
		D template = new D();
		try
		{
			template.solve();
		}
		catch (IOException exception)
		{
			exception.printStackTrace();
		}
		template.close();
	}

	public static int[] destroy(int[] h)
	{
		int[] result = new int[h.length];
		for (int index = 0; index < h.length; index++)
		{
			if (h[index] > 0)
			{
				int internal = h[index] - 1;
				if (index > 0)
				{
					internal = Math.min(internal, h[index - 1]);
				}
				else
				{
					internal = 0;
				}
				if (index < h.length - 1)
				{
					internal = Math.min(internal, h[index + 1]);
				}
				else
				{
					internal = 0;
				}
				result[index] = internal;
			}
		}
		return result;
	}

	public static boolean destroyed(int[] h)
	{
		boolean result = true;
		for (int index = 0; index < h.length; index++)
		{
			result &= h[index] == 0;
		}
		return result;
	}

	public static int solve(int n, int[] h)
	{
		int result = 0;
		for (int index = 0; index < h.length; index++)
		{
			if (index == 0)
			{
				h[index] = Math.min(1, h[index]);
			}
			else
			{
				h[index] = Math.min(h[index - 1] + 1, h[index]);
			}
		}
		for (int index = h.length - 1; index >= 0; index--)
		{
			if (index == h.length - 1)
			{
				h[index] = Math.min(1, h[index]);
			}
			else
			{
				h[index] = Math.min(h[index + 1] + 1, h[index]);
			}
			result = Math.max(result, h[index]);
		}
		//		while (!destroyed(h))
		//		{
		//			result += 1;
		//			h = destroy(h);
		//		}
		return result;
	}

	public void solve() throws IOException
	{
		int n = nextInt();
		int[] h = new int[n];
		for (int index = 0; index < n; index++)
		{
			h[index] = nextInt();
		}
		this.printWriter.println(solve(n, h));
	}
}


import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public int howMuch(int n, int [] t) {
		int worst = 0;
		int [] res = new int[n];
		Arrays.fill(res, 0);
		for(int i = 0; i<n; i++) {
			worst = Math.min(worst, t[i] - i);
			res[i] = i + worst;
		}
		worst = n;
		for(int i = n - 1; i>=0; i--) {
			worst = Math.min(worst, t[i] + i);
			res[i] = Math.min(res[i], worst - i);
		}
		int r = 0;
		for(int i = 0; i<n; i++) {
			r = Math.max(r, res[i]);
		}
		return r;
	}

	public static void main(String [] argv) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int []a = new int[n];
		for(int i = 0; i<n; i++) {
			a[i] = sc.nextInt();

		}
		Main main = new Main();
		System.out.println(main.howMuch(n, a));
	}
}


import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public int howMuch(int n, int [] t) {
		int worst = 0;
		int [] res = new int[n + 1];
		Arrays.fill(res, 0);
		for(int i = 1; i<=n; i++) {
			worst = Math.min(worst, t[i - 1] - i);
			res[i] = i + worst;
		}
		worst = n + 1;
		for(int i = n; i>=1; i--) {
			worst = Math.min(worst, t[i - 1] + i);
			res[i] = Math.min(res[i], worst - i);
		}
		int r = 0;
		for(int i = 1; i<=n; i++) {
			r = Math.max(r, res[i]);
		}
		return r;
	}

	public static void main(String [] argv) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int []a = new int[n];
		for(int i = 0; i<n; i++) {
			a[i] = sc.nextInt();

		}
		Main main = new Main();
		System.out.println(main.howMuch(n, a));
	}
}


import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author asdf_alex
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = in.nextIntArray(n);
        int[] le = new int[n], ri = new int[n];
        int d = 0;
        for (int i = 0; i < n; ++i){
            ++d;
            d = Math.min(d, a[i]);
            le[i] = d;
        }
        d = 0;
        int ans = 0;
        for (int i = n-1; i >= 0; --i){
            ++d;
            d = Math.min(d, a[i]);
            ri[i] = d;
        }
        for (int i = 0; i < n; ++i) ans = Math.max(ans, Math.min(le[i], ri[i]));
        out.println(ans);
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public int[] nextIntArray(int size) {
        int[] result = new int[size];
        for (int i = 0; i < size; i++) {
            result[i] = nextInt();
        }
        return result;
    }
}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R318_Div2_D
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R318_Div2_D().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int n = in.nextInt();

		int[] h = new int[n];
		int[] l = new int[n];
		int[] r = new int[n];
		for (int i = 0; i < n; i++)
			h[i] = in.nextInt();

		l[0] = 1;
		for (int i = 1; i < n; i++)
			l[i] = Math.min(h[i], Math.min(i+1, h[i-1]+1));

		r[n-1] = 1;
		for (int i = n-2; i >= 0; i--)
			r[i] = Math.min(h[i], Math.min(n-i, h[i+1]+1));

		int max = 0;
		for (int i = 0; i < n; i++)
			max = Math.max(max,  Math.min(l[i],  r[i]));

		out.println(max);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R318_Div2_D
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R318_Div2_D().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int n = in.nextInt();

		int[] a = new int[n];
		int[] remove = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextInt();

		boolean done = false;
		int cnt = 0;
		while (!done)
		{
			for (int i = 0 + cnt; i < n - cnt; i++)
			{
				if (a[i] > 0)
				{
					int max = a[i];
					if (i > 0 + cnt && i < n-1 - cnt)
					{
						int min = Math.min(a[i-1], a[i+1]);
						if (min >= a[i]) max = 1;
						else max = a[i] - min;
					}
					remove[i] = max;
				}
			}
			done = true;
			for (int i = 0 + cnt; i < n - cnt; i++)
			{
				a[i] -= remove[i];
				if (a[i] > 0) done = false;
			}
			cnt++;
		}

		out.println(cnt);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R318_Div2_D
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R318_Div2_D().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int n = in.nextInt();

		int[] h = new int[n];
		int[] l = new int[n];
		int[] r = new int[n];
		for (int i = 0; i < n; i++)
			h[i] = in.nextInt();

		l[0] = 1;
		for (int i = 1; i < n; i++)
			l[i] = Math.min(h[i], Math.min(i+1, l[i-1]+1));

		r[n-1] = 1;
		for (int i = n-2; i >= 0; i--)
			r[i] = Math.min(h[i], Math.min(n-i, r[i+1]+1));

		int max = 0;
		for (int i = 0; i < n; i++)
			max = Math.max(max,  Math.min(l[i],  r[i]));

		out.println(max);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.io.*;
import java.util.*;

public class cf318_d_2 {

    public void solve() throws IOException {
        int n = nextInt();
        int a[] = new int[n];
        int l[] = new int[n];
        int r[] = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = nextInt();
        }
        l[0] = 1;
        for (int i = 1; i < n; ++i) {
            l[i] = Math.min(a[i], l[i - 1] + 1);
        }
        r[n - 1] = 1;
        for (int i = n - 2; i >= 0; --i) {
            r[i] = Math.min(a[i], r[i + 1] + 1);
        }
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            ans = Math.max(ans, Math.min(l[i], r[i]));
        }
        out.print(ans);
    }

    public void run() throws IOException {
        try {
            // br = new BufferedReader(new FileReader(new File(".in")));
            // out = new PrintWriter(".out");
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            br.close();
            out.close();
        } catch (IOException e) {

        }

    }

    public static void main(String[] args) throws IOException {
        new cf318_d_2().run();
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            try {
                in = new StringTokenizer(br.readLine());
            } catch (IOException | NullPointerException e) {
                throw new IOException();
            }
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
}


import java.io.*;
import java.util.*;

public class D {
	InputStream is;

	int __t__ = 1;
	int __f__ = 0;
	int __FILE_DEBUG_FLAG__ = __f__;
	String __DEBUG_FILE_NAME__ = "src/T";

	FastScanner in;
	PrintWriter out;

	class State implements Comparable<State> {
		int id;
		int op;

		State(int id, int op) {
			this.id = id;
			this.op = op;
		}

		public int compareTo(State s) {
			return op - s.op;
		}

		public String toString() {
			return getClass().getName() + " : " + id + " " + op;
		}
	}

	public void solve() {
		int n = in.nextInt();
		int[] h = in.nextIntArray(n);

		PriorityQueue<State> pq = new PriorityQueue<State>();
		int[] operation = new int[n];
		Arrays.fill(operation, Integer.MAX_VALUE);
		boolean[] used = new boolean[n];
		for (int i = 0; i < n; i++) {
			operation[i] = Math.min(i + 1, n - i);
			operation[i] = Math.min(operation[i], h[i]);
			pq.add(new State(i, operation[i]));
		}

		int res = 0;
		while (!pq.isEmpty()) {
			State st = pq.poll();
			if (used[st.id]) continue;
			used[st.id] = true;

			res = Math.max(res, st.op);
			if (st.id > 0 && !used[st.id-1]) {
				int nextId = st.id - 1;
				int nextOp = Math.min(st.op + 1, operation[nextId]);
				pq.add(new State(nextId, nextOp));
			}
			if (st.id < n - 1 && !used[st.id+1]) {
				int nextId = st.id + 1;
				int nextOp = Math.min(st.op + 1, operation[nextId]);
				pq.add(new State(nextId, nextOp));
			}
		}
		System.out.println(res);
	}

	public void run() {
		if (__FILE_DEBUG_FLAG__ == __t__) {
			try {
				is = new FileInputStream(__DEBUG_FILE_NAME__);
			} catch (FileNotFoundException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			System.out.println("FILE_INPUT!");
		} else {
			is = System.in;
		}
		in = new FastScanner(is);
		out = new PrintWriter(System.out);

		solve();
	}

	public static void main(String[] args) {
		new D().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		int[][] nextIntMap(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextIntArray(m);
			}
			return map;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		long[][] nextLongMap(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextLongArray(m);
			}
			return map;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		double[][] nextDoubleMap(int n, int m) {
			double[][] map = new double[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextDoubleArray(m);
			}
			return map;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}


import java.io.*;
import java.util.*;

public class D {
	InputStream is;

	int __t__ = 1;
	int __f__ = 0;
	int __FILE_DEBUG_FLAG__ = __f__;
	String __DEBUG_FILE_NAME__ = "src/T";

	FastScanner in;
	PrintWriter out;

	class State implements Comparable<State> {
		int id;
		int op;

		State(int id, int op) {
			this.id = id;
			this.op = op;
		}

		public int compareTo(State s) {
			return op - s.op;
		}

		public String toString() {
			return getClass().getName() + " : " + id + " " + op;
		}
	}

	public void solve() {
		int n = in.nextInt();
		int[] h = in.nextIntArray(n);

		PriorityQueue<State> pq = new PriorityQueue<State>();
		int[] operation = new int[n];
		Arrays.fill(operation, Integer.MAX_VALUE);
		boolean[] used = new boolean[n];
		for (int i = 0; i < n; i++) {
			operation[i] = Math.min(i + 1, n - i);
			operation[i] = Math.min(operation[i], h[i]);
			if (operation[i] == 1) {
				pq.add(new State(i, operation[i]));
				used[i] = true;
			}
		}

		int res = 0;
		while (!pq.isEmpty()) {
			State st = pq.poll();
			res = Math.max(res, st.op);

			if (st.id > 0 && !used[st.id-1]) {
				int nextId = st.id - 1;
				int nextOp = Math.min(st.op + 1, operation[nextId]);
				used[nextId] = true;
				pq.add(new State(nextId, nextOp));
			}
			if (st.id < n - 1 && !used[st.id+1]) {
				int nextId = st.id + 1;
				int nextOp = Math.min(st.op + 1, operation[nextId]);
				used[nextId] = true;
				pq.add(new State(nextId, nextOp));
			}
		}
		System.out.println(res);
	}

	public void run() {
		if (__FILE_DEBUG_FLAG__ == __t__) {
			try {
				is = new FileInputStream(__DEBUG_FILE_NAME__);
			} catch (FileNotFoundException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			System.out.println("FILE_INPUT!");
		} else {
			is = System.in;
		}
		in = new FastScanner(is);
		out = new PrintWriter(System.out);

		solve();
	}

	public static void main(String[] args) {
		new D().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		int[][] nextIntMap(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextIntArray(m);
			}
			return map;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		long[][] nextLongMap(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextLongArray(m);
			}
			return map;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		double[][] nextDoubleMap(int n, int m) {
			double[][] map = new double[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextDoubleArray(m);
			}
			return map;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}


import java.util.*;
import java.io.*;

public class CF574D{
  public static int index;
  public static void main(String[] args)throws Exception {
    InputReader in = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
    int n = in.nextInt();
    int [] a = new int[n+2];
    for(int i = 1; i <= n; i++){
      a[i] = in.nextInt();
    }

    for(int i = 1; i <= n; i++){
      if(a[i-1] < a[i]) a[i] = a[i-1] + 1;
    }

    for(int i = n; i >= 1; i--){
      if(a[i+1] < a[i]) a[i] = a[i+1] + 1;
    }

    int max = 0;
    for(int i = 1; i <= n; i++){
      max = Math.max(max, a[i]);
    }

    pw.println(max);

    pw.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream));
      tokenizer = null;
    }

    public String next()throws Exception {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
        tokenizer = new StringTokenizer(reader.readLine());
      return tokenizer.nextToken();
    }

    public String nextLine()throws Exception {
      String line = null;
      tokenizer = null;
      line =  reader.readLine();
      return line;
    }

    public int nextInt()throws Exception {
      return Integer.parseInt(next());
    }

    public double nextDouble() throws Exception{
      return Double.parseDouble(next());
    }

    public long nextLong()throws Exception {
      return Long.parseLong(next());
    }

  }
}


import java.io.*;
import java.util.*;

public class PrD {
	public static void main(String[] args) throws IOException {
		new PrD().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out, true);
		solve();
		out.flush();
	}
	// int n;
	// int[] a;
	// int[] time;
	//
	// int getTime(int i) {
	// if(i == 0 || i == n + 1) {
	// return 0;
	// }
	// if(time[i] != 0) {
	// return time[i];
	// }
	// time[i] = Math.min(Math.min(time[i-1] + 1, time[i+1] + 1), a[i]);
	// return time[i];
	// }
	//

	void solve() throws IOException {
		int n = nextInt();
		int[] a = new int[n + 2];
		for (int i = 1; i <= n; i++) {
			a[i] = nextInt();
		}
		int[] time = new int[n + 2];
		TreeSet<Integer> magic = new TreeSet<Integer>(new Comparator<Integer>() {

			@Override
			public int compare(Integer o1, Integer o2) {
				if (time[o1] != time[o2]) {
					return Integer.compare(time[o1], time[o2]);
				}
				return Integer.compare(o1, o2);
			}
		});
		// magic.add(0);
		// magic.add(n+1);
		for (int i = 1; i <= n; i++) {
			time[i] = Math.min(i, Math.min(n - i + 1, a[i]));
			magic.add(i);
		}
		while (!magic.isEmpty()) {
			int min = magic.pollFirst();
			if (time[min - 1] > time[min] + 1) {
				magic.remove(min - 1);
				time[min - 1] = time[min] + 1;
				magic.add(min - 1);
			}
			if (time[min + 1] > time[min] + 1) {
				magic.remove(min + 1);
				time[min + 1] = time[min] + 1;
				magic.add(min + 1);
			}
		}
		int max = 0;
		for (int i = 1; i <= n; i++) {
			max = Math.max(max, time[i]);
		}
		out.println(max);
		// for(int i = 1; i <= n; i++) {
		// if(time[i] == 0) {
		// getTime(i);
		// }
		// }
	}
}


import java.util.Scanner;

/**
 * Created by slycer on 9/15/15.
 */
public class BearandBlocks {

    public static void main ( String [] args ){
        Scanner s = new Scanner( System.in );
        int n = s.nextInt();
        int [] data = new int[n+2];
        for ( int i=1; i<=n; i++ ){
            data[i] = s.nextInt();
        }

        int sol = 0;

        while ( true ){

            boolean gata = true;
            int [] descoperite = new int[n+2];
            for ( int i=1; i<=n; i++ ){
                descoperite[i] = Math.max( data[i] - data[i-1], Math.max(1, data[i] - data[i+1] ) );
                if ( descoperite[i] > 0 && data[i] > 0 ){
                    gata = false;
                }
            }

            if ( gata ){
                break;
            }

            sol ++;
            for ( int i=1; i<=n; i++ ){
                if ( descoperite[i] > 0 && data[i] > 0 ){
                    data[i] = data[i] - descoperite[i];
                }
                //System.out.print( data[i] + " " );
            }
            //System.out.println();
        }

        System.out.println( sol );

    }

}


import java.util.Scanner;

/**
 * Created by slycer on 9/15/15.
 */
public class BearandBlocks {

    public static void main ( String [] args ){
        Scanner s = new Scanner( System.in );
        int n = s.nextInt();
        int [] data = new int[n+2];
        for ( int i=1; i<=n; i++ ){
            data[i] = s.nextInt();
        }

        int [] left = new int[ n + 2 ];
        int [] right = new int[ n + 2 ];

        for ( int i=1; i<=n; i++ ){
            left[i] = Math.min( left[i-1] + 1, data[i] );
           // System.out.print( left[i] + " " );
        }
        //System.out.println();

        for ( int i=n; i>=1; i-- ){
            right[i] = Math.min( right[i+1] + 1, data[i] );
            //System.out.print( right[i] + " " );
        }
        //System.out.println();

        int sol = 0;
        for ( int i=1; i<=n; i++ ){
            sol = Math.max( sol, Math.min( left[i], right[i] ) ) ;
        }

        System.out.println( sol );

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author padington
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] h = new int[n + 1];
            int[] res = new int[n + 2];
            for (int i = 1; i <= n; i++) {
                h[i] = in.nextInt();
            }

            for (int i = 1; i <= n; i++) {
                res[i] = minOfArray(res[i - 1] + 1, i, h[i]);
            }
            int ans = 0;
            for (int i = n; i > 0; i--) {
                res[i] = minOfArray(res[i], res[i + 1] + 1, n - i + 1);
                ans = Math.max(ans, res[i]);
            }
            out.println(ans);
        }

        int minOfArray(int... array) {
            return IntStream.of(array).min().getAsInt();
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author padington
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] h = new int[n + 1];
            int[] res = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                h[i] = in.nextInt();
            }

            int worst = 0;
            for (int i = 1; i <= n; i++) {
                worst = Math.min(worst, h[i] - i);
                res[i] = i + worst;
            }
            worst = 0;
            int ans = 0;
            for (int i = n; i > 0; i--) {
                worst = Math.min(worst, h[i] - (n - i + 1));
                res[i] = Math.min(res[i], worst + (n - i + 1));
                ans = Math.max(ans, res[i]);
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author padington
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] h = new int[n + 1];
            int[] res = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                h[i] = in.nextInt();
            }

            int worst = 0;
            for (int i = 1; i <= n; i++) {
                worst = Math.min(worst, h[i] - i);
                res[i] = i + worst;
            }
            worst = 0;
            int ans = 0;
            for (int i = n; i > 0; i--) {
                worst = Math.min(worst, h[i] - (n - i + 1));
                res[i] = Math.min(res[i], worst + (n - i + 1));
                res[i] = Math.min(res[i], (n - i + 1));
                ans = Math.max(ans, res[i]);
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author padington
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] h = new int[n];
            int[] h2 = new int[n];
            for (int i = 0; i < n; i++) {
                h[i] = in.nextInt();
            }

            for (int k = 0; k <= n / 2 + 1; k++) {
                boolean flag = true;
                for (int i = k + 1; i < n - k - 1; i++) {
                    int mn = Math.min(h[i - 1], h[i + 1]);
                    if (mn < h[i]) {
                        h2[i] = mn;
                    } else {
                        h2[i] = h[i] - 1;
                    }
                    if (h2[i] > 0) {
                        flag = false;
                    }
                }
                if (flag) {
                    out.println(k + 1);
                    return;
                }
                for (int i = k + 1; i < n - k - 1; i++) {
                    h[i] = h2[i];
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.util.Scanner;

public class A {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();

		int i;
		int c;
		int[] h= new int[100001];
		int[] b= new int[100001];

		for (i=1;i<=n;i++){
			h[i] = in.nextInt();
		}

		int l=0;
		boolean e=true;
		while (e){
			l++;

			for (i=1+l;i<=n-l;i++){
				c=Math.min(h[i-1], h[i+1]);
				if (c<h[i]){
					b[i]=h[i]-c;
				}else{
					b[i]=1;
				}
			}

			e=false;
			for (i=1+l;i<=n-l;i++){
				h[i]-=b[i];
				if (h[i]>0) e=true;
			}

		}

		System.out.print(l);

		in.close();

	}
}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class Main {
    private FastScanner in;
    private PrintWriter out;

    private void solve() throws IOException {

        int n = in.nextInt(), ans = 0;
        int[] h = new int[n + 1], l = new int[n + 1], r = new int[n + 2];

        for (int i = 1; i <= n; i++)
            h[i] = in.nextInt();

        for (int i = 1; i <= n; i++)
            l[i] = min(l[i - 1] + 1, h[i]);

        for (int i = n; i > 0; i--)
            r[i] = min(r[i + 1] + 1, h[i]);

        for (int i = 1; i <= n; i++)
            ans = max(ans, min(l[i], r[i]));

        out.print(ans);
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean ready() throws IOException {
            return br.ready();
        }

    }

    private void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		int i, k=0;
		int[]  h= new  int[100002];
		int[]  l= new  int[100002];
		int[]  r= new  int[100002];

		int n=in.nextInt();

		for (i=1; i<=n; i++)
			h[i]=in.nextInt();

		for (i=1; i<=n; i++)
			l[i] = Math.min(l[i - 1] + 1, h[i]);

		for (i=n; i>0; i--)
			r[i] = Math.min(r[i + 1] + 1, h[i]);

		for (i=1; i<=n; i++)
			k = Math.max(k, Math.min(l[i], r[i]));

		System.out.print(k+"");

		in.close();
	}
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		int i, k=0;
		int[]  h= new  int[100000];
		int[]  l= new  int[100000];
		int[]  r= new  int[100000];

		int n=in.nextInt();

		for (i=0; i<n; i++)
			h[i]=in.nextInt();

		for (i=0; i<n; i++)
			l[i] = Math.min(l[i - 1] + 1, h[i]);

		for (i=n-1; i>=0; i--)
			r[i] = Math.min(r[i + 1] + 1, h[i]);

		for (i=1; i<=n; i++)
			k = Math.max(k, Math.min(l[i], r[i]));

		System.out.print(k+"");

		in.close();
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] m = new int[n];
            for (int i = 0; i < n; ++i) m[i] = in.nextInt();

            int[] right = new int[n];
            int[] left = new int[n];
            right[0] = left[n - 1] = 1;
            int res = 0;
            for (int i = 1; i < n; ++i) right[i] = Math.min(right[i - 1] + 1, m[i]);
            for (int i = n - 2; i >= 0; --i) left[i] = Math.min(left[i + 1] + 1, m[i]);
            for (int i = 0; i < n; ++i) res = Math.max(res, Math.min(right[i], left[i]));
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.Scanner;
//
public class GYM2E {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}
		int[] left = new int[n];
		int[] right = new int[n];
		left[0] = 1;
		right[n-1] = 1;
		for(int i = 1; i < n; i++){
			left[i] = Math.min(arr[i]-1, left[i-1])+1;
		}
		for(int i = n-2; i >= 0; i--){
			right[i] = Math.min(arr[i]-1, right[i+1])+1;
		}
		int ans = 0;
		for(int i = 0; i < n; i++){
			ans = Math.max(ans, Math.min(left[i], right[i]));
		}
		System.out.println(ans);
	}
}


import java.io.PrintStream;
import java.util.Scanner;

public class myclass {

	public static PrintStream out = System.out;
    public static Scanner in = new Scanner(System.in);

    public static void main(String[] args){
    	int n = in.nextInt();
    	int a[] = new int[n];
    	for (int i = 0; i < n; i++)
    		a[i] = in.nextInt();
    	int dp1[]= new int[n], dp2[] = new int[n];
    	dp1[0] = 1;
    	for (int i = 1; i < n; i++)
    		dp1[i] = Math.min(dp1[i - 1] + 1, a[i]);
    	dp2[n - 1] = 1;
    	for (int i = n - 2; i >= 0; i--)
    		dp2[i] = Math.min(dp2[i + 1] + 1, a[i]);
    	int ans = 0;
    	for (int i = 0; i < n; i++)
    		ans = Math.max(ans, Math.min(dp1[i], dp2[i]));
    	out.println(ans);
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class DBlocks {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(new BufferedInputStream(System.in));
        final PrintWriter writer = new PrintWriter(new BufferedOutputStream(System.out));

        int N = scanner.nextInt();
        int[] height = new int[N];
        int[] deadWhen = new int[N];

        for (int i = 0; i < N; i++) {
            height[i] = scanner.nextInt();
            // by default, al sides get destroyed.
            deadWhen[i] = Math.min(i + 1, N - i);
        }

        // check if anyone can die earlier
        for (int i = 0; i < N; i++) {
            if (height[i] < deadWhen[i]) {
                // this guy is dying early.
                deadWhen[i] = height[i];

                // update both sides accordingly
                int left = i - 1;
                int right = i + 1;
                int leftEffect = deadWhen[i] + 1;
                while (0 <= left) {
                    if (leftEffect < deadWhen[left]) {
                        deadWhen[left] = leftEffect;
                        leftEffect++;
                        left--;
                    } else {
                        break; // no more cascading effect
                    }
                }
                int rightEffect = deadWhen[i] + 1;
                while (right < N) {
                    if (rightEffect < deadWhen[right]) {
                        deadWhen[right] = rightEffect;
                        rightEffect++;
                        right++;
                    } else {
                        break;
                    }
                }
            }
        }

        int res = deadWhen[0];
        for (int i = 1; i < N; i++)
            res = Math.max(res, deadWhen[i]);
        writer.println(res);
        writer.flush();
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class DBlocks {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(new BufferedInputStream(System.in));
        final PrintWriter writer = new PrintWriter(new BufferedOutputStream(System.out));

        int N = scanner.nextInt();
        int[] height = new int[N];
        int[] deadWhen = new int[N];

        for (int i = 0; i < N; i++) {
            height[i] = scanner.nextInt();
            // by default, al sides get destroyed.
            deadWhen[i] = Math.min(i + 1, N - i);
        }

        // check if anyone can die earlier
        for (int i = 0; i < N; i++) {
            if (height[i] < deadWhen[i]) {
                // this guy is dying early.
                deadWhen[i] = height[i];
            }

            // both sides die right after this guy if possible
            int left = i - 1;
            int right = i + 1;

            if (0 <= left) {
                deadWhen[left] = Math.min(deadWhen[left], deadWhen[i] + 1);
            }
            if (right < N) {
                deadWhen[right] = Math.min(deadWhen[right], deadWhen[i] + 1);
            }
        }

        int res = deadWhen[0];
        for (int i = 1; i < N; i++)
            res = Math.max(res, deadWhen[i]);
        writer.println(res);
        writer.flush();
    }
}


import java.io.BufferedInputStream;
import java.util.Scanner;

public class DBlocks {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(new BufferedInputStream(System.in));

        int N = scanner.nextInt();
        int[] height = new int[N + 1];
        int[] shutdown = new int[N + 1];

        for (int i = 1; i <= N; i++)
            height[i] = scanner.nextInt();

        int cascade = 0;
        for (int i = 1; i <= N; i++) {
            cascade = Math.min(cascade, height[i] - i); // note that cascade is always a non-positive number
            shutdown[i] = i + cascade;
        }

        cascade = 0;
        for (int i = N; i >= 1; i--) {
            cascade = Math.min(cascade, height[i] - (N - i + 1));
            shutdown[i] = Math.min(shutdown[i], (N - i + 1) + cascade);
        }

        int minTime = 0;
        for (int i = 1; i <= N; i++)
            minTime = Math.max(minTime, shutdown[i]);

        System.out.println(minTime);
    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class SolveD {
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        new SolveD().run();
    }

    public void solve() throws IOException {
      int n = nextInt();
      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
    	  a[i] = nextInt();
      }
      int[] needLeft = new int[n];
      int[] needRight = new int[n];
      for (int i = 0; i < n; i++) {
    	  if (i == 0) {
    		  needLeft[i] = 1;
    		  needRight[n - i - 1] = 1;
    	  } else {
    		  needLeft[i] = Math.min(needLeft[i - 1], a[i - 1]) + 1;
    		  needRight[n - i - 1] = Math.min(needRight[n - i], a[n - i]) + 1;
    	  }

      }
      int answer = 0;
      for (int i = 0; i < n; i++) {
    	  int current = Math.min(a[i],Math.min(needLeft[i], needRight[i]));
    	  answer = Math.max(answer, current);
      }
      out.println(answer);
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in)); // new InputStreamReader(System.in)
            out = new PrintWriter(System.out); // System.out

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class SolveD {
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        new SolveD().run();
    }

    public void solve() throws IOException {
      int n = nextInt();
      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
    	  a[i] = nextInt();
      }
      int[] needLeft = new int[n];
      int[] needRight = new int[n];
      for (int i = 0; i < n; i++) {
    	  if (i == 0) {
    		  needLeft[i] = a[0];
    		  needRight[n - i - 1] = a[n - 1];
    	  } else {
    		  needLeft[i] = Math.min(needLeft[i - 1], a[i - 1]) + 1;
    		  needRight[n - i - 1] = Math.min(needRight[n - i], a[n - i]) + 1;
    	  }

      }
      int answer = 0;
      for (int i = 0; i < n; i++) {
    	  int current = Math.min(a[i] - 1,Math.min(needLeft[i], needRight[i]));
    	  answer = Math.max(answer, current);
      }
      out.println(answer);
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in)); // new InputStreamReader(System.in)
            out = new PrintWriter(System.out); // System.out

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class q5 {

	 public static int gcd(int a,int b) {
		 if(b==0) return a;
		 else return gcd(b,a%b);
	 }

	 // Credits to GFG
	 static public int dfs(ArrayList<Integer>[] graph,ArrayList<Integer> arr, int start, int[] visited) {
		 visited[start]=1;
		 boolean leaf=true;
		 int ans=0;
		 int totalchild=0;
		 for(int i:graph[start]) {
			 if(visited[i]==0) {
				 ans+=q5.dfs(graph, arr, i, visited);
				 leaf=false;
			 }
		 }
		 if(leaf) ans=1;
		 arr.add(ans);
		 return ans;

	 }

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		// Editorial implementation for practice
		Reader.init(System.in);
		StringBuffer output=new StringBuffer("");
		PrintWriter out=new PrintWriter(System.out);
		int n=Reader.nextInt();
		int[] arr=new int[n+2];
		for(int i=1;i<=n;i++) arr[i]=Reader.nextInt();
		for(int i=1;i<=n;i++) {
			arr[i]=Math.min(arr[i], arr[i-1]+1);
		}
		for(int i=n;i>=1;i--) {
			arr[i]=Math.min(arr[i], arr[i+1]+1);
		}
		int max=0;
		for(int i=1;i<=n;i++) {
			max=Math.max(max, arr[i]);
		}
		output.append(max);
		out.write(output.toString());
		out.flush();
	}
}

class Node2{
	String name;
	double ft,st;
	Node2(String a,double b,double c){
		name=a;
		ft=b;
		st=c;
	}

}

class Heap{
	int[] mylist;
	int[] mymap;
	int[] vtxmymap;
	int size;
	long[] update;
	long updatevalue;
	int[] removed;
	Heap(int[] graph){
		int l=graph.length;
		updatevalue=0;
		removed=new int[l];
		update=new long[l];
		size=l-1;
		mylist=new int[l];
		mymap=new int[l];
		vtxmymap=new int[l];
		for(int i=size;i>0;i--) {
			if(i>size/2) {
				mylist[i]=graph[i];
				mymap[i]=i;
				vtxmymap[i]=i;
			}
			else {
				mylist[i]=graph[i];
				mymap[i]=i;
				vtxmymap[i]=i;
				boolean end=false;
				int parent=i;
				while(!end) {
					int leftchild=2*parent;
					int rightchild=2*parent+1;
					if(leftchild>size) {
						end=true;
					}
					else if(rightchild>size) {
						if(mylist[leftchild]<mylist[parent]) {
							int parentNode=vtxmymap[parent];
							int childNode=vtxmymap[leftchild];
							int parentDeg=mylist[parent];
							int childDeg=mylist[leftchild];
							mylist[parent]=childDeg;
							mylist[leftchild]=parentDeg;
							mymap[parentNode]=leftchild;
							mymap[childNode]=parent;
							vtxmymap[parent]=childNode;
							vtxmymap[leftchild]=parentNode;
							parent=leftchild;
						}
						else end=true;
					}
					else {
						if(mylist[leftchild]<=mylist[rightchild]) {
							if(mylist[leftchild]<mylist[parent]) {
								int parentNode=vtxmymap[parent];
								int childNode=vtxmymap[leftchild];
								int parentDeg=mylist[parent];
								int childDeg=mylist[leftchild];
								mylist[parent]=childDeg;
								mylist[leftchild]=parentDeg;
								mymap[parentNode]=leftchild;
								mymap[childNode]=parent;
								vtxmymap[parent]=childNode;
								vtxmymap[leftchild]=parentNode;
								parent=leftchild;
							}
							else end=true;
						}
						else {
							if(mylist[rightchild]<mylist[parent]) {
								int parentNode=vtxmymap[parent];
								int childNode=vtxmymap[rightchild];
								int parentDeg=mylist[parent];
								int childDeg=mylist[rightchild];
								mylist[parent]=childDeg;
								mylist[rightchild]=parentDeg;
								mymap[parentNode]=rightchild;
								mymap[childNode]=parent;
								vtxmymap[parent]=childNode;
								vtxmymap[rightchild]=parentNode;
								parent=rightchild;
							}
							else end=true;
						}
					}
				}
			}
		}
	}

	void update(int child) {
		if(update[child]==updatevalue) return;
		boolean end=false;
		while(!end) {
			update[child]=updatevalue;
			int parent=child/2;
			if(parent<1) end=true;
			else {
				if(mylist[parent]>mylist[child]) {
					int parentNode=vtxmymap[parent];
					int childNode=vtxmymap[child];
					int parentDeg=mylist[parent];
					int childDeg=mylist[child];
					mylist[parent]=childDeg;
					mylist[child]=parentDeg;
					mymap[parentNode]=child;
					mymap[childNode]=parent;
					vtxmymap[parent]=childNode;
					vtxmymap[child]=parentNode;
					parent=child;
				}
				else end=true;
			}
		}
	}

	int peek() {
		return mylist[1];
	}

	int pop() {
		int toreturn=mylist[1];
		removed[vtxmymap[1]]=1;
		mylist[1]=mylist[size];
		int changedNode=vtxmymap[size];
		vtxmymap[1]=changedNode;
		mymap[changedNode]=1;
		boolean end=false;
		size--;
		if(size==0) end=true;
		int parent=1;
		while(!end) {
			int leftchild=2*parent;
			int rightchild=2*parent+1;
			if(leftchild>size) {
				end=true;
			}
			else if(rightchild>size) {
				if(mylist[leftchild]<mylist[parent]) {
					int parentNode=vtxmymap[parent];
					int childNode=vtxmymap[leftchild];
					int parentDeg=mylist[parent];
					int childDeg=mylist[leftchild];
					mylist[parent]=childDeg;
					mylist[leftchild]=parentDeg;
					mymap[parentNode]=leftchild;
					mymap[childNode]=parent;
					vtxmymap[parent]=childNode;
					vtxmymap[leftchild]=parentNode;
					parent=leftchild;
				}
				else end=true;
			}
			else {
				if(mylist[leftchild]<=mylist[rightchild]) {
					if(mylist[leftchild]<mylist[parent]) {
						int parentNode=vtxmymap[parent];
						int childNode=vtxmymap[leftchild];
						int parentDeg=mylist[parent];
						int childDeg=mylist[leftchild];
						mylist[parent]=childDeg;
						mylist[leftchild]=parentDeg;
						mymap[parentNode]=leftchild;
						mymap[childNode]=parent;
						vtxmymap[parent]=childNode;
						vtxmymap[leftchild]=parentNode;
						parent=leftchild;
					}
					else end=true;
				}
				else {
					if(mylist[rightchild]<mylist[parent]) {
						int parentNode=vtxmymap[parent];
						int childNode=vtxmymap[rightchild];
						int parentDeg=mylist[parent];
						int childDeg=mylist[rightchild];
						mylist[parent]=childDeg;
						mylist[rightchild]=parentDeg;
						mymap[parentNode]=rightchild;
						mymap[childNode]=parent;
						vtxmymap[parent]=childNode;
						vtxmymap[rightchild]=parentNode;
						parent=rightchild;
					}
					else end=true;
				}
			}
		}

		return toreturn;
	}

}

 class DisJoint {
		int[] parent;
		int[] rank;
		int[] size;
		DisJoint(int n){

			parent=new int[n+1];
			rank=new int[n+1];
			for(int i=0;i<=n;i++) {
				parent[i]=i;
			}
		}

		int find(int value) {
			int par=parent[value];
			if(par==value)
				return par;
			parent[value]=find(par);
			return parent[value];
		}

		void union(int data1,int data2) {
			int parent1=find(data1);
			int parent2=find(data2);
			if(parent1!=parent2) {
				if(rank[parent1]>=rank[parent2]) {
					parent[parent2]=parent1;
					if(rank[parent1]==rank[parent2])
						rank[parent1]++;
				}
				else {
					parent[parent1]=parent2;
		}

		}
		}
}

 class Reader {
	    static BufferedReader reader;
	    static StringTokenizer tokenizer;

	    /** call this method to initialize reader for InputStream */
	    static void init(InputStream input) {
	        reader = new BufferedReader(
	                     new InputStreamReader(input) );
	        tokenizer = new StringTokenizer("");
	    }

	    /** get next word */
	    static String nextLine() throws IOException{
	    	return reader.readLine();
	    }
	    static String next() throws IOException {
	        while ( ! tokenizer.hasMoreTokens() ) {
	            //TODO add check for eof if necessary
	            tokenizer = new StringTokenizer(
	                   reader.readLine() );
	        }
	        return tokenizer.nextToken();
	    }

	    static int nextInt() throws IOException {
	        return Integer.parseInt( next() );
	    }
	    static long nextLong() throws IOException {
	        return Long.parseLong( next() );
	    }
	    static double nextDouble() throws IOException {
	        return Double.parseDouble( next() );
	    }
	}


import java.io.IOException;
import java.util.InputMismatchException;

public class BearAndBlocks {
	public static void main(String[] args) {
		FasterScanner sc = new FasterScanner();

		int N = sc.nextInt();

		int[] H = new int[N + 2];
		for (int i = 1; i <= N; i++) {
			H[i] = sc.nextInt();
		}

		int[] dl = new int[N + 2];
		int L = 0;
		for (int i = 1; i <= N; i++) {
			if (dist(H, i, i) <= dist(H, L, i)) {
				L = i;
			}
			dl[i] = dist(H, L, i);
		}

		int[] dr = new int[N + 2];
		int R = N + 1;
		for (int i = N; i >= 1; i--) {
			if (dist(H, i, i) <= dist(H, R, i)) {
				R = i;
			}
			dr[i] = dist(H, R, i);
		}

		int maxDist = 0;
		for (int i = 1; i <= N; i++) {
			int dist = Math.min(dl[i], dr[i]);
			maxDist = Math.max(maxDist, dist);
		}
		System.out.println(maxDist);
	}

	public static int dist(int[] H, int space, int block) {
		return H[space] + Math.abs(space - block);
	}

	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			return nextIntArray(n, 0);
		}

		public int[] nextIntArray(int n, int off) {
			int[] arr = new int[n + off];
			for (int i = 0; i < n; i++) {
				arr[i + off] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			return nextLongArray(n, 0);
		}

		public long[] nextLongArray(int n, int off) {
			long[] arr = new long[n + off];
			for (int i = 0; i < n; i++) {
				arr[i + off] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}


import java.io.IOException;
import java.util.InputMismatchException;

public class BearAndBlocks {
	public static void main(String[] args) {
		FasterScanner sc = new FasterScanner();

		int N = sc.nextInt();

		int[] H = new int[N + 2];
		for (int i = 1; i <= N; i++) {
			H[i] = sc.nextInt();
		}

		int L = 0;
		int R = 2;
		int best = 0;
		for (int i = 1; i <= N; i++) {
//			while (L < i && dist(H, L + 1, i) <= dist(H, L, i)) {
//				L++;
//			}
			if (dist(H, i, i) <= dist(H, L, i)) {
				L = i;
			}
			R = Math.max(R, i + 1);
			while (R <= N && dist(H, R + 1, i) <= dist(H, R, i)) {
				R++;
			}
			int reqDist = Math.min(dist(H, L, i), dist(H, R, i));
			best = Math.max(best, reqDist);
//			System.out.format("i = %d | L = %d, distL = %d | R = %d, distR = %d\n", i, L, dist(H, L, i), R, dist(H, R, i));
		}
		System.out.println(best);
	}

	public static int dist(int[] H, int space, int block) {
		return H[space] + Math.abs(space - block);
	}

	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			return nextIntArray(n, 0);
		}

		public int[] nextIntArray(int n, int off) {
			int[] arr = new int[n + off];
			for (int i = 0; i < n; i++) {
				arr[i + off] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			return nextLongArray(n, 0);
		}

		public long[] nextLongArray(int n, int off) {
			long[] arr = new long[n + off];
			for (int i = 0; i < n; i++) {
				arr[i + off] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class p4 {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();
        int[] h = new int[n];
        int[] left = new int[n];
        int[] right = new int[n];
        left[0] = 1; right[n - 1] = 1;
        for (int i = 0; i < n; i++) {
            h[i] = in.nextInt();
        }
        for (int i = 1; i < n; i++) {
            left[i] = Math.min(h[i], Math.min(i + 1, left[i - 1] + 1));
        }
        for (int i = n - 2; i >= 0; i--) {
            right[i] = Math.min(h[i], Math.min(n - i, right[i + 1] + 1));
        }
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            max = Math.max(max, Math.min(left[i], right[i]));
        }
        out.println(max);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasMoreElements() {
            while (tokenizer == null || !tokenizer.hasMoreElements()) {
                String s;
                try {
                    s = reader.readLine();
                } catch (IOException e) {
                    return false;
                }
                tokenizer = new StringTokenizer(s);
            }
            return tokenizer.hasMoreElements();
        }
    }
}


import java.util.*;
import java.io.*;
public class Main {
public static void main(String [] args)throws Exception{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int n = Integer.parseInt(br.readLine());
	int array[] = new int[n];
	StringTokenizer st = new StringTokenizer(br.readLine());
	for(int i = 0;i < n;i++){
		array[i] = Integer.parseInt(st.nextToken());
	}
    int low = 0;
    int high = n/2 + 5;

    while(low < high){
    	int mid = (low + high)/2;
    	boolean forward[] = new boolean[n];
    	boolean backward[] = new boolean[n];
    	int cnt = 1;
    	for(int i = 0;i < n;i++){
    		if(array[i] < cnt){
    			cnt = array[i];
    		}
    		if(cnt == mid){
    			forward[i - mid + 1] = true;
    			cnt--;
    		}
    		cnt++;
    	}
    	cnt = 1;
    	for(int i = n - 1;i >= 0;i--){
    		if(array[i] < cnt){
    			cnt = array[i];
    		}
    		if(cnt == mid){
    			backward[i + mid - 1] = true;
    			cnt--;
    		}
    		cnt++;
    	}
    	boolean flag = false;
    	for(int i = 0;i < n;i++){
    		//System.out.println(i + " " + (i + 2*mid - 2));
    		if(i + 2*mid - 2 < n && forward[i] && backward[i + 2*mid - 2]){
    		flag = true;
    	}
    	}
    	//System.out.println(mid + " " + flag);
    	if(!flag)high = mid;
    	else low = mid + 1;
    }
    System.out.print(low - 1);

}
}


import java.util.*;
import java.io.*;
public class Main {
public static void main(String [] args)throws Exception{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int n = Integer.parseInt(br.readLine());
	int array[] = new int[n];
	StringTokenizer st = new StringTokenizer(br.readLine());
	for(int i = 0;i < n;i++){
		array[i] = Integer.parseInt(st.nextToken());
	}
    int low = 0;
    int high = n/2 + 1;

    while(low < high){
    	int mid = (low + high)/2;
    	boolean forward[] = new boolean[n];
    	boolean backward[] = new boolean[n];
    	int cnt = 1;
    	for(int i = 0;i < n;i++){
    		if(array[i] < cnt){
    			cnt = array[i];
    		}
    		if(cnt == mid){
    			forward[i - mid + 1] = true;
    			cnt--;
    		}
    		cnt++;
    	}
    	cnt = 1;
    	for(int i = n - 1;i >= 0;i--){
    		if(array[i] < cnt){
    			cnt = array[i];
    		}
    		if(cnt == mid){
    			backward[i + mid - 1] = true;
    			cnt--;
    		}
    		cnt++;
    	}
    	boolean flag = false;
    	for(int i = 0;i < n;i++){
    		//System.out.println(i + " " + (i + 2*mid - 2));
    		if(i + 2*mid - 2 < n && forward[i] && backward[i + 2*mid - 2]){
    		flag = true;
    	}
    	}
    	//System.out.println(mid + " " + flag);
    	if(!flag)high = mid;
    	else low = mid + 1;
    }
    System.out.print(low - 1);

}
}


import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Artyom Korzun
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
        int n = in.nextInt();
        int[] h = in.nextIntArray(n);

        int[] l = new int[n];
        int[] r = new int[n];
        l[0] = 1;
        for (int i = 1; i < n; i++)
            l[i] = Math.min(h[i], l[i - 1] + 1);

        r[n - 1] = 1;
        for (int i = n - 2; i >= 0; i--)
            r[i] = Math.min(h[i], r[i + 1] + 1);

        int answer = -1;
        for (int i = 0; i < n; i++)
            answer = Math.max(answer, Math.min(r[i], l[i]));

        out.print(answer);
    }
}

class FastScanner {

    private final BufferedReader reader;

    private StringTokenizer tokenizer;

    public FastScanner(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public int[] nextIntArray(int length) {
        int[] array = new int[length];
        for (int i = 0; i < length; i++)
            array[i] = nextInt();

        return array;
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(nextLine());

        return tokenizer.nextToken();
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}


import java.util.Scanner;

/**
 * @author misterku
 */
public class Solution implements Runnable {

    public static void main(String[] args) {
        new Thread(new Solution()).start();
    }

    @Override
    public void run() {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Math.min(i + 1, n - i);
            if (i > 0) {
                a[i] = Math.min(a[i - 1] + 1, a[i]);
            }
            int c = cin.nextInt();
            if (c >= a[i]) {
                continue;
            }
            a[i] = c;
            int tmp = i - 1;
            while (tmp >= 0 && a[tmp] > a[tmp + 1] + 1) {
                a[tmp] = a[tmp + 1] + 1;
                tmp--;
            }
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans = Math.max(ans, a[i]);
        }
        System.out.println(ans);
    }
}


import java.io.PrintWriter;
import java.util.*;
import java.util.stream.IntStream;

import static java.lang.Math.*;

import static java.util.stream.IntStream.range;

public class Sub {

    public static void main(String[] args) throws Exception {
        new Sub().doit();
    }

    public long gcdl(long a, long b) {
        if (b == 0) return a;
        return gcdl(b, a % b);
    }

    public long lcml(long a, long b) {
        return (b / gcdl(a, b)) * a;
    }

    public int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    public int lcm(int a, int b) {
        return (b / gcd(a, b)) * a;
    }

    boolean check(int[] z) {
        for (int i = 0; i < z.length; i++) {
            if (z[i] != 0) return false;
        }
        return true;
    }

    public void doit() throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();

        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }

        int res = 0;

        int[] dpLeft = new int[n];
        int[] dpRight = new int[n];

        Arrays.fill(dpLeft, 987654321);
        Arrays.fill(dpRight, 987654321);

        dpLeft[0] = 1;
        dpRight[n-1] = 1;

        for (int i = 1; i < n; i++) {
            dpLeft[i] = min(arr[i], dpLeft[i-1] + 1);
        }
        for (int i = 1; i < n; i++) {
            dpRight[n-1-i] = min(arr[n-1-i], dpRight[n - i] + 1);
        }

        int mx = 0;
        for (int i = 0; i < n; i++) {
            mx = max(mx, min(dpLeft[i], dpRight[i]));
            //System.err.print(dpLeft[i] + ":" + dpRight[i] + "  ");
        }
        out.println(mx);

        sc.close();
        out.close();
    }

}


#include <bits/stdc++.h>

using namespace std;

int a[100001];
int n , res=0 ;

int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);

bool add=0;
int x=0;
int shift=1;
bool f=1;
while(f){
add=0;
f=0;

for(int i=shift+1;i<=n-shift;i++){

 int c=min( a[i]-1 ,  min(  a[i-1] , a[i+1]  )  ) ;
if(a[i] > 0)add=1;
 a[i-1]=x;
    if( c >0 ){ f=1; }

 x=c;
 }
 a[n-shift+1]=0;

 if( (shift==1 &&  (a[1]>0 || a[n]>0) ) || add==1 )res++;
}
    cout<<res<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int a[100001];
int n , res=0 ;

int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);

if(a[1]>0 || a[n]>0)res=1;

int x=0;
int shift=1;
bool f=1;
while(f){

f=0;

for(int i=shift+1;i<=n-shift;i++){

 int c=min( a[i]-1 ,  min(  a[i-1] , a[i+1]  )  ) ;

 a[i-1]=x;
    if( c >0 ){ f=1; }

 x=c;
 }
 a[n-shift+1]=0;

 if(f)res++;
}
    cout<<res<<endl;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
int N = 100009;
int n , left[N] , right[N] , h[N] ;
cin>>n;

for(int i=1;i<=n;i++)
    cin>>h[i];

left[1]=1;
for(int i=2;i<=n;i++)
    left[i]=min( h[i] , left[i-1]+1 );

right[n]=1;
for(int i=n-1;i>=1;i--)
    right[i]=min( h[i] , right[i+1]+1 );

int ans=-1;

for(int i=1;i<=n;i++)
    ans=max(ans, min(left[i],right[i]) );

cout<<ans<<endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define whatis(x) cout << #x << " is " << x << endl;

#define MAX 1000001
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265359

#define STDSYNC std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define swap(VAR1,VAR2) VAR1=VAR1^VAR2;VAR2=VAR1^VAR2;VAR1=VAR1^VAR2

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef priority_queue < ll , vector < ll > , greater < ll > > minheap;
typedef priority_queue < ll , vector < ll > , less < ll > > maxheap;

ll arr[1000001];
ll removal[1000001];
ll lefts[10000001];
ll rights[10000001];

int main()
{
	STDSYNC;
	ll rem,a,b,c,i,j,k,n,m;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> arr[i];
	}
	ll ans=0;
	ll maxx=0;
	for(i=0;i<n;i++){
		rem=1;
		if(i==0 || i==n-1)
			rem=max(rem,arr[i]);
		if(i-1>=0){
			rem=max(rem,arr[i]-arr[i-1]);
		}
		if(i+1<n){
			rem=max(rem,arr[i]-arr[i+1]);
		}
		removal[i]=rem;
	}
	for(i=0;i<n;i++){
		arr[i]-=removal[i];
	}
	lefts[0]=0;
	rights[n-1]=0;
	for(i=1;i<n;i++){
		if(arr[i-1]==0)
			lefts[i]=0;
		else
			lefts[i]=lefts[i-1]+1;
	}
	for(i=n-2;i>=0;i--){
		if(arr[i+1]==0)
			rights[i]=0;
		else
			rights[i]=rights[i+1]+1;
	}
	maxx=0;
	for(i=1;i<n-1;i++){
		if(arr[i]!=0){
			maxx=max(maxx,(ll)1);
			ll temp=min(lefts[i]+1,rights[i]+1);
			temp=min(temp,arr[i]);
			maxx=max(maxx,temp);
		}
	}
	cout << 1+maxx << endl;
	return 0;
}