n = input()
l = map(int, raw_input().split())
l = [i-1 for i in l]
white, black = 0, 0

for i in range(0, n, 2):
	black += abs(i-l[i/2])
for i in range(1, n, 2):
	white += abs(i-l[(i/2)])

print min(white, black)