import os
import sys
import math

def solve(n, inpArray):
    i = 0
    odds, evens = 0, 0
    while (2 * i) < n:
        odds += abs(inpArray[i] - (2 * i + 1))
        evens += abs(inpArray[i] - (2 * i + 2))
        i += 1
    return min(odds, evens)

if __name__ == '__main__':

    n = int(input())
    inpArray = input().split()
    inpArray = [int(i) for i in inpArray]
    print(solve(n, inpArray))
