n = int(raw_input())
ar = sorted(map(int, raw_input().split()))

ar1 = sorted([i for i in xrange(1,n+1) if i not in ar])

fi = [x for x in xrange(1,n+1)]

k = 0

fin = []

if min(fi) in ar:
	for j in xrange((n/2)):
		fin.append(ar[j])
		fin.append(ar1[j])
	ans = 0

	for f in ar:
		ans += (abs(fin.index(f) - fi.index(f)))

	print ans

elif min(fi) in ar1:
	for j in xrange((n/2)):
		fin.append(ar1[j])
		fin.append(ar[j])

	ans = 0

	for f in ar:
		ans += (abs(fin.index(f) - fi.index(f)))

	print ans





#n = list(map(int, input().split()))

#nums = sorted(list(map(int, input().split())))

#act1 = 0
#act2 = 0
#for i,x in enumerate(nums):
#    act1 += abs(2 * i + 1 - x)
#    act2 += abs(2 * i + 2 - x)

#print(min(act1, act2))