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>).
INF = 10**10
n = int(input())
nums = list(map(int, input().split()))
s = 0
seen = set()
dup = []
under = []
over = []
for num in nums:
    if num < 1:
        under.append(num)
    elif num<=n:
        if num in seen:
            dup.append(num)
        else:
            seen.add(num)
    else:
        over.append(num)
dup = sorted(dup, reverse=True)
under = sorted(under)
over = sorted(over, reverse=True)
d = INF if len(dup)==0 else dup.pop()
u = -INF if len(under)==0 else under.pop()
o = INF if len(over)==0 else over.pop()
for i in range(1, n+1):
    if i in seen:
        continue
    seen.add(i)
    d_ = abs(d-i)
    u_ = i-u
    o_ = o-i
    if d_ <= u_ and d_ <= o_:
        s+= d_
        d = INF if len(dup) == 0 else dup.pop()
    elif o_ < u_ and o_ < d_:
        s+= o_
        o = INF if len(over) == 0 else over.pop()
    else:
        s+=u_
        u = -INF if len(under) == 0 else under.pop()
print(s)
