def dist(a, b):
    return sum(abs(x - y) for x, y in zip(a, b))

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = min(dist(a, range(1, n + 1, 2)), dist(a, range(2, n + 1, 2)))
    print(ans)

main()
