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>).
import math


def main_function():
    n = int(input())
    a = sorted([[int(i), False] for i in input().split(" ")], key=lambda x:x[0])
    hash_table = [0 for i in range(n + 1)]
    for i in range(len(a)):
        if 0 < a[i][0] <= n:
            a[i][1] = True
            hash_table[a[i][0]] = 1
    current_index = 0
    counter = 0
    # print(hash_table)
    # print(a)
    for i in range(1, len(hash_table)):
        if hash_table[i] == 0:
            while a[current_index][1] is True:
                current_index += 1
            counter += abs(a[current_index][0] - i)
            current_index += 1
    print(counter)









main_function()