# No.693 square1001 and Permutation 2 n = int(input()) a = [int(s) for s in input().split()] b = list(range(1, n + 1)) cost = 0 for i in range(n): if a[i] in b: b[b.index(a[i])] = 0 a[i] = 0 a_dash = [i for i in a if i != 0] b_dash = [i for i in b if i != 0] for i in range(len(a_dash)): cost += abs(a_dash[i] - b_dash[i]) print(cost)