Permutation *p* is an ordered set of integers *p*<sub class="lower-index">1</sub>,  *p*<sub class="lower-index">2</sub>,  ...,  *p*<sub class="lower-index">*n*</sub>, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p* as *p*<sub class="lower-index">*i*</sub>. We'll call number *n* the size or the length of permutation *p*<sub class="lower-index">1</sub>,  *p*<sub class="lower-index">2</sub>,  ...,  *p*<sub class="lower-index">*n*</sub>.

You have a sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. In one move, you are allowed to decrease or increase any number by one. Count the minimum number of moves, needed to build a permutation from this sequence.
The first line contains integer *n* (1 ≤ *n* ≤ 3·10<sup class="upper-index">5</sup>) — the size of the sought permutation. The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> ( - 10<sup class="upper-index">9</sup> ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
n=int(input())
a=[int(c) for c in input().split()]
a.sort()
b=[]
c=[]
for i in range(0,n+1):

        try :
            a.index(i)
            b.append(i)
        except:
            c.append(i)
            pass
        else:
            pass
index1=a.index(b[0])
index2=a.index(b[len(b)-1])
sum=0
c=a[:index1]+a[index2+1:]
coun=0
for i in c:
    if i<0:
        sum+=abs(i)
        coun+=1
    else:
        sum+=i-n

for i in range(1,n+1):

    if i in b:

        continue
    else:
        if coun>0:
            sum+=i
        else:
            sum+=n-i



if 0 in c:
    sum+=1
print(sum)





