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

odd=0
even=0

for i in range(0, n):

    if i<n//2:
        B[i] = int(B[i])-1

    if i%2 == 0:
        even += abs(i - B[i//2])

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

print(min(even, odd))
