Fewest changes to make a mountain

A mountain array rises by exactly 1 per step from both ends towards the middle, with equal values at matching distances from the two ends, for example 1 2 3 2 1 or 6 7 8 8 7 6. Find the fewest elements you must change to turn the array into a mountain (values may become zero or negative).

Reported in: Infosys (SP / DSE · earlier papers) (memory-based)

Input

First line: N. Second line: N integers.

Output

The fewest changes.

Constraints

1 ≤ N ≤ 10^5; |A[i]| ≤ 10^9.

Example 1

Input:
5
1 2 3 2 1

Output:
0

Example 2

Input:
5
1 2 4 2 1

Output:
1

Example 3

Input:
6
3 4 5 9 4 3

Output:
1

Example 4

Input:
4
1 1 1 1

Output:
2

Hint: In a mountain, A[i] = base + min(i, N − 1 − i). Work out the base each element implies; keep the base that the most elements agree on, and the answer is N minus that count.

All coding practice