from operator import sub
import sys

n = int(sys.stdin.readline())
plist = map(int, sys.stdin.readline().split())

blist = range(1, n + 1, 2)
wlist = range(2, n + 1, 2)
bmoves = map(sub, plist, blist)
wmoves = map(sub, plist, wlist)
bmovestotal = sum(map(abs, bmoves))
wmovestotal = sum(map(abs, wmoves))
print(min(bmovestotal, wmovestotal))