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>).
def solve(n):
    per = [0]*n
    l = list(); count = 0
    for i in input().split():
        i = int(i)
        if 0 < i <= n:
            if per[i-1] == 0:
                per[i-1] = 1
            else:
                l.append(i)
        else:
            l.append(i)

    if l != []:
        l.sort()
    for i in range(n):
        if per[i] == 0:
            if l[0] < 0:
                count += (abs(l.pop(0)) + i+1)
            else:
                count += abs((i+1)-l.pop(0))
    return count

def main():
    print(solve(int(input())))

if __name__ == "__main__":
    main()