n = int(input())
P = list(map(int, input().split()))
P1 = list(range(2, n+2, 2))
P2 = list(range(1, n+1, 2))
o, e = 0, 0
for i in range(len(P)):
    e += abs(P1[i]-P[i])
    o += abs(P2[i]-P[i])
print(min(e, o))
