n = int(input())
pieces = list(map(int, input().split(' ')))

def even():
    diffEven = 0
    for i in range(len(pieces)):
        diffEven += abs(pieces[i] - ((i+1)*2))
        
    return(diffEven)
    
def odd():
    diffOdd = 0
    for j in range(len(pieces)):
        diffOdd += abs(pieces[j] - ((j*2)+1))
        
    return(diffOdd)

white = even()
black = odd()

print(min(black, white))
        