def main(): import sys input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) min_time = float('inf') for s in range(1, N + 1): left_max = 0 for i in range(1, s + 1): temp = A[i - 1] + (s - i) if temp > left_max: left_max = temp right_max = 0 for i in range(s, N + 1): temp = A[i - 1] + (i - s) if temp > right_max: right_max = temp current_max = max(left_max, right_max) if current_max < min_time: min_time = current_max print(min_time) if __name__ == "__main__": main()