N=int(raw_input()) A=map(int,raw_input().split()) ans = 10000 for n in range(1,N+1,2): plus = 0 minus =0 for i in range(n/2): if A[i] > (i+1): plus += A[i]-(i+1) else: minus += (i+1)-A[i] if A[n-1-i] > (i+1): plus += A[n-1-i]-(i+1) else: minus += (i+1)-A[n-1-i] if A[n/2]>(n/2+1): plus += A[n/2]-(n/2+1) else: minus += (n/2+1)-A[n/2] for i in range(n,N): plus += A[i] #print n, plus, minus ans=min(ans,max(plus,minus)) print ans