n=int(input())
s=input().split()
a = list(map(int, s))

k=int(n/2)

m1=0

for i in range (k):
    m1 += abs(a[i]-(2*i+1))
    #print (abs(a[i]-(2*i+1)))


m2=0

for i in range (k):
    m2 += abs(a[i]-(2*i+2))
    #print(abs(a[i]-(2*i+2)))

print(min(m1, m2))
