#JMD
#Nagendra Jha-4096

#a=list(map(int,sys.stdin.readline().split(' ')))
#n,k,s= map(int, sys.stdin.readline().split(' '))

import sys
import math

#import fractions
#import numpy

###Defines...###
mod=1000000007

###FUF's...###
def nospace(l):
	ans=''.join(str(i) for i in l)
	return ans



##### Main ####

n=int(input())
a=list(map(int,sys.stdin.readline().split(' ')))
a.sort()
anso=0
anse=0
#for odd..
if(a[0]%2):
	p=a[0]
else:
	p=a[0]-1
for i in range(n//2):
	anso+=abs(a[i]-p)
	p+=2
	if(p>n and i!=(n//2)-1):
		anso=10000000
		break
#for even...
if(a[0]%2):
	if(a[0]==1):
		p=2
	else:
		p=a[0]-1
else:
	p=a[0]
for i in range(n//2):
	anse+=abs(a[i]-p)
	p+=2
	if(p>n and i!=(n//2)-1):
		anse=10000000
		break
anso1=0
anse1=0
#for odd back..
if(a[-1]%2):
	p=a[-1]
else:
	if(a[-1]==n):
		p=a[-1]-1
	else:
		p=a[-1]+1
for i in range(n//2):
	anso1+=abs(a[i]-p)
	p+=2
	if(p>n and i!=(n//2)-1):
		anso1=10000000
		break
#for even...
if(a[-1]%2):
	p=a[-1]+1
else:
	p=a[-1]
for i in range(n//2):
	anse1+=abs(a[i]-p)
	p+=2
	if(p>n and i!=(n//2)-1):
		anse1=10000000
		break
print(min(anso,anse,anso1,anse1))
