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())
s=n*(n+1)//2
L=list(map(int,input().split(' ')))
count1=0
count2=0
L=sorted(L)
m=[]
M=[]

i=0
while L[i]<1:
  m.append(L[i])
  i=i+1
  
j=0
while L[len(L)-1-j]>n:
  M.append(L[len(L)-1-j])
  j=j+1
mm=[0]*(n+1)
e=i
while e<len(L)-j:
  mm[L[e]]=L[e]
  e=e+1
cc=0
k=1
c=1
sum1=sum(m)
sum2=sum(mm)
sum3=sum(M)
if sum2!=0:
  while cc<len(m):
    if mm[k]!=c:
      count1=count1+c
      cc=cc+1 
    
    k=k+1
    c=c+1 
  
  
  count2=s-count1-sum2
else:
  count1=len(m)*(len(m)+1)//2 
  count2=s-count1

res1=count1-sum1+sum3-count2
print(res1)
    
    
  