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>).
from collections import Counter, defaultdict
from sys import stdin,stdout
import io , os , sys
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
input = stdin.readline
 
mod = 998244353 
 
def mapinput():
    return  map(int, input().split())
 
def listinput():
    return  list( map( int, input().split()))
 
def intinput():
    return int(stdin.readline())
 
def strinput():
    return input().strip()
 
def SieveOfEratosthenes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    prime[0]= False
    prime[1]= False
    ans = []
    for p in range(n + 1):
        if prime[p]:
            ans.append(p)
    return ans
 
def writ(ss):
    stdout.write(str(ss) + "\n")
 
def mult(a , b, mod):
    return ((a% mod) * (b%mod) ) % mod
 
 
def binn(arr , val , lower):
    low = 0
    high = len(arr) -1 
    while low<= high:
        
        mid = (low + high) >> 1 
        #print(low , high , mid , arr[mid] , val)
        if arr[mid] == val:
            return mid
        elif arr[mid] < val:
            low = mid + 1 
        else:
            high = mid -1
    if lower:
        return high
    return low
 
for test in range(1):
    n = intinput()
    arr = listinput()
    arr.sort()
    ans = 0 
    for i in range(n):
        ans += abs( i+1 - arr[i]  )
    writ(ans)