"""Problem A - Chess Placing.

http://codeforces.com/contest/985/problem/a

You are given a chessboard of size 1 × n. It is guaranteed that n is even. The
chessboard is painted like this: "BWBW...BW".

Some cells of the board are occupied by the chess pieces. Each cell contains
no more than one chess piece. It is known that the total number of pieces
equals to .

In one step you can move one of the pieces one cell to the left or to the
right. You cannot move pieces beyond the borders of the board. You also cannot
move pieces to the cells that are already occupied.

Your task is to place all the pieces in the cells of the same color using the
minimum number of moves (all the pieces must occupy only the black cells or
only the white cells after all the moves are made).

Input:

The first line of the input contains one integer n (2 ≤ n ≤ 100, n is even) —
the size of the chessboard.

The second line of the input contains integer numbers (1 ≤ pi ≤ n) — initial
positions of the pieces. It is guaranteed that all the positions are distinct.

Output:

Print one integer — the minimum number of moves you have to make to place all
the pieces in the cells of the same color.

"""
import logging


fmt = '%(levelname)s - %(name)s (line:%(lineno)s) - %(message)s'
formatter = logging.Formatter(fmt)

ch = logging.StreamHandler()
ch.setLevel(logging.ERROR)
ch.setFormatter(formatter)

logger = logging.getLogger('chess_placing')
logger.setLevel(logging.ERROR)
logger.addHandler(ch)


# def moves(seq, moving, even=True):
#     m = 0 if even else 1

#     x = seq[moving]
#     if x - 1 > 0 and x - 1 not in seq:
#         seq[i] = x - 1

#     if all(x % 2 == m for x in positions):
#         return 0
    
    # count = 0
    # for i, x in enumerate(seq):
    #     if x % 2 != m:
    #         if x - 1 > 0 and x - 1 not in seq:
                
    #             count += 1
    #             continue
    #     elif x % 2 == m:


# def solve(n, positions):
#     if all(x % 2 == 0 for x in positions):
#         return 0
#     if all(x % 2 != 0 for x in positions):
#         return 0

#     count = 0
#     again = False
#     while True:
#         for i in range(len(positions) - 1):
#             for j in reversed(range(i + 1, len(positions))):
#                 distance = positions[j] - positions[i]
#                 min_dist = 2 * (j - i)
#                 # if distance < min_dist or (distance == min_dist and positions[i] % 2 != positions[j] % 2):
#                 if distance < min_dist:
#                     diff = 2 * (j - i) - distance
#                     # diff += positions[i] % 2 != positions[j] % 2
#                     count += diff
#                     if positions[i] - diff > 0 and positions[i] - diff not in positions:
#                         positions[i] = positions[i] - diff
#                     elif positions[i] + diff <= n:
#                         positions[j] = n
#                         again = True
#                         break
#                     else:
#                         u = j
#                         while True:
#                             if positions[u] 

#                     logger.debug(positions)
#                 if again:
#                     break
#         if not again:
#             break

#     adj = min(
#         abs(sum(x % 2 == 0 for x in positions) - len(positions)),
#         abs(sum(x % 2 != 0 for x in positions) - len(positions)))
#     return count + adj

def solve(pos):
    return min(
        sum(abs(2 * i + 1 - pos[i]) for i in range(len(pos))),
        sum(abs(2 * i + 2 - pos[i]) for i in range(len(pos)))
    )


# def solve(pos):
#     if all(b - a == 2 for a, b in zip(pos, pos[1:])):
#         return 0
#     cost = 0
#     for i in range(len(pos) - 1):
#         if pos[i + 1] - pos[i] != 2:
#             if pos[i] - 1 >= 1 and pos[i] - 1 not in pos and (i > 0 and not (pos[i] - pos[i - 1] <= 2)):
#                 pos[i] -= 1
#                 cost = min(cost, 1 + solve(pos))
#                 pos[i] += 1  # backtrack
            
#             if pos[i + 1] + 1 <= 2 * len(pos) and pos[i + 1] + 1 not in pos:
#                 pos[i + 1] += 1
#                 cost = min(cost, 1 + solve(pos))
#                 pos[i + 1] -= 1  # backtrack
#             elif pos[i + 1] - 1 not in pos:
#                 pos[i + 1] -= 1
#                 cost = min(cost, 1 + solve(pos))
#                 pos[i + 1] += 1  # backtrack   
#     return min_so_far       



def main():
    _ = input()
    positions = [int(x) for x in input().strip().split()]
    result = solve(positions)
    print(result)
    

if __name__ == '__main__':
    main()
