import itertools
import math
n=input()
n=int(n)
zoma=int(n/2)
list = [int(x) for x in input().split()]
sorted(list)
evenCount=0
oddCount=0
for i, j in zip(range(n,0,-2), range(zoma-1,0,-1)):
    if list[j]!=i:
        evenCount += abs(i-list[j])

for i, j in zip(range(n-1,0,-2), range(zoma-1,0,-1)):
    if list[j] != i:
        oddCount += abs(i-list[j])

print(min(evenCount,oddCount))