import sys
from sys import stdin, stdout
from collections import deque
rem=10**9+7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())

n=input()
arr=take()
arr.sort()
a=0
b=0
for i in range(n/2):
	a+=abs(2*i+1-arr[i])
	b+=abs(2*i+2-arr[i])
print min(a,b)







