n = int(input())

l = input().split(" ")
l = [int(e) for e in l]

assert len(l) == n // 2

s1 = 0
s2 = 0

for (i, x) in enumerate(l):
    s1 += abs(2*i + 1 - x)
    s2 += abs(2*i + 2 - x)

print(min(s1, s2))
