n = int(input())
B = input().split()

for i in range(0, n//2):
    B[i] = int(B[i])-1

odd=0
even=0

for i in range(0, n):
    
    if i%2 == 0:
        even += abs(i - B[i//2])

    else:
        odd += abs(i - B[i//2])

print(min(even, odd))
