n = int(input())
p = list(map(int, input().split()))

white = [x for x in range(1, n+1, 2)]
black = [x for x in range(2, n+1, 2)]

ws = sum([abs(white[i]-p[i]) for i in range(n//2)])
bs = sum([abs(black[i]-p[i]) for i in range(n//2)])

print(min(ws, bs))
