def main():
    N = int(input())
    P = list(map(int, input().split()))

    P.sort()
    even, odd = 0, 0
    for i, j in enumerate(range(2, N + 1, 2)):
        even += abs(P[i] - j)
    for i, j in enumerate(range(1, N + 1, 2)):
        odd += abs(P[i] - j)
    print(min(even, odd))

main()
