#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 21 22:31:07 2018

@author: thomas
"""

n=int(input())
integer_numbers=input()
init_position=[int(x)-1 for x in integer_numbers.split()]
#we consider 2 cases: all Black or all White
sum_B=0
for i in range(len(init_position)):
    sum_B+=abs(init_position[i]-2*i)

sum_W=0
for i in range(len(init_position)):
    sum_W+=abs(init_position[i]-2*i-1)
print(min(sum_B, sum_W))