n = int(input().strip())
f = list(map(int , input().split()))
k = len(f)
assert k == n //2
ma = sum(abs(f[i] - 2*(i+1)) for i in range(k))
mb = sum(abs(f[i] - (2*i+1)) for i in range(k))


print(min(ma, mb))
