import math
#n,k = map(int, input().strip().split(' '))
n=int(input())
lst = list(map(int, input().strip().split(' ')))
sum_odd=0
sum_even=0
for i in range(n//2):
    sum_odd+=abs(lst[i]-(2*i+1))
for i in range(n//2):
    sum_even+=abs(lst[i]-(2*(i+1)))
print(min(sum_odd,sum_even))
    