def count(a):
    s = 0
    i = 2
    j = 1
    if a[0] % 2 == 0:
        for e in a:
            s = s + abs(e-i)
            i = i+2
        return s
    else:
        for e in a:
            s = s + abs(e-j)
            j = j+2
        return s
c = input()
a = [int(x) for x in input().split()]
print(count(a))