n = int(input())

pos = list(map(int, input().split(' ')))

countStepB = 0
for i in range(len(pos)):
    cur = pos[i]
    if cur < (1+i*2):
        countStepB += abs((1+i*2) - cur)
    elif cur > (1+i*2) and cur % (1+i*2) != 0:
        countStepB += 1

countStepW = 0
for i in range(len(pos)):
    cur = pos[i]

    if cur < (2+i*2):
        countStepW += abs((2+i*2) - cur)
    elif cur > (2+i*2) and cur % (2+i*2) != 0:
        countStepW += 1


if countStepB > countStepW:
    print(countStepW)

else:
    print(countStepB)