while True:
    n = int(input())
    B = input().split()

    odd=0
    even=0

    for i in range(0, n//2):
        B[i] = int(B[i])-1

    B.sort()

    for i in range(0, n):
        
        if i%2 == 0:
            even += abs(i - B[i//2])

        else:
            odd += abs(i - B[i//2])

    print(min(even, odd))

    break
