from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin
from itertools import *
from fractions import Fraction
import string
import copy
import random
import bisect
from decimal import *
def id_generator(size=20, chars=string.digits):
    return ''.join(random.choice(chars) for _ in range(size))
 
def mp():
    return map(int,str(raw_input()).split())

n=input()
l=list(mp())
l.sort()
for i in range(n/2):
    l[i]-=1
x=[i for i in range(0,n,2)]
y=[i for i in range(1,n,2)]
a1,a2=0,0
print l,x,y
for i in range(n/2):
    a2+=abs(l[i]-y[i])
    a1+=abs(l[i]-x[i])
print min(a1,a2)