N = int(input())
data = input().split()

pos = [int(i) for i in data]
odd = 0
even = 0

start = 1
for p in pos:
	odd += abs(p - start)
	even += abs(p - (start + 1))
	start += 2

print(min(odd, even))
