def getMoveCountToFillEvenIndex(chessPieceIndexList):
    evenIndexList = [2*(x + 1) for x in range(len(chessPieceIndexList))]
    res = sum(abs(index - chessPieceIndex) for index, chessPieceIndex in zip(chessPieceIndexList, evenIndexList))
    return res;

def getMoveCountToFillOddIndex(chessPieceIndexList):
    OddIndexList = [2*(x + 1) - 1 for x in range(len(chessPieceIndexList))]
    res = sum(abs(index - chessPieceIndex) for index, chessPieceIndex in zip(chessPieceIndexList, OddIndexList))
    return res;

n = int(input())
chessPieceIndexList = [int(x) for x in raw_input().split(" ")]
moveCountToFillEvenIndex = getMoveCountToFillEvenIndex(chessPieceIndexList)
moveCountToFillOddIndex = getMoveCountToFillOddIndex(chessPieceIndexList)
print min(moveCountToFillEvenIndex, moveCountToFillOddIndex)