5051: Trees

内存限制:256 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:4 通过:3

题目描述



在Bertown的主要街道上生长着n棵树,树数i的高度为ai米(1≤i≤n)。随着Berland的总统的到来,这些树木被决定改变,使它们的高度形成一个美丽的序列。这意味着两端的树的高度(第1棵树和第n棵树)应该相等,第2棵树和(n-1)第1棵树的高度也必须相等,第2棵树的高度应该比第1棵树的高度大1,依此类推。换句话说,距离边缘(序列的一端)等距离的树的高度必须彼此相等,并且随着距离边缘增加1,树的高度也必须增加1。例如,序列“2 3 4 5 5 4 3 2”和“1 2 3 2 1”是漂亮的,而“1 3 3 1”和“1 2 3 1”则不是。

改变树的高度是一项非常昂贵的操作,需要使用伯兰科学家发明的先进技术。在一个操作中,您可以选择任何树并将其高度更改为任何数字,可以增加或减少。注意,即使在改变之后,高度仍然应该是一个正整数,即,它不能小于或等于零。确定树木高度变化的最小数量,以使它们的高度顺序变得美丽。

输入

第一行包含整数n(1≤n≤105),是树的数量。第二行包含整数ai(1≤ai≤105),它们是树的高度。

输出

打印一个数字,这是树的最小数量,其高度将不得不改变序列变得美丽。

例子

time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

On Bertown's main street n trees are growing, the tree number i has the height of ai meters (1≤in). By the arrival of the President of Berland these trees were decided to be changed so that their heights formed a beautiful sequence. This means that the heights of trees on ends (the 1st one and the n-th one) should be equal to each other, the heights of the 2-nd and the (n-1)-th tree must also be equal to each other, at that the height of the 2-nd tree should be larger than the height of the first tree by 1, and so on. In other words, the heights of the trees, standing at equal distance from the edge (of one end of the sequence) must be equal to each other, and with the increasing of the distance from the edge by 1 the tree height must also increase by 1. For example, the sequences "2 3 4 5 5 4 3 2" and "1 2 3 2 1" are beautiful, and '1 3 3 1" and "1 2 3 1" are not.
Changing the height of a tree is a very expensive operation, using advanced technologies invented by Berland scientists. In one operation you can choose any tree and change its height to any number, either increase or decrease. Note that even after the change the height should remain a positive integer, i. e, it can't be less than or equal to zero. Identify the smallest number of changes of the trees' height needed for the sequence of their heights to become beautiful.
Input
The first line contains integer n (1≤n≤105) which is the number of trees. The second line contains integers ai (1≤ai≤105) which are the heights of the trees.
Output
Print a single number which is the minimal number of trees whose heights will have to be changed for the sequence to become beautiful.
Examples
Input
3
2 2 2
Output
1
Input
4
1 2 2 1
Output
0

输入样例 复制


输出样例 复制