def solve_1(seq):
    last_free_cell = 1
    ans = 0
    for el in seq:
        ans += abs(el - last_free_cell)
        last_free_cell+=2

    return ans

def solve_2(seq):
    last_free_cell = 2
    ans = 0
    for el in seq:
        ans += abs(el - last_free_cell)
        last_free_cell+=2

    return ans


n= int(input())

data = list(map(int,input().split()))

print(min(solve_1(data), solve_2(data)))
