def main(): N = int(input()) A = list(map(int, input().split())) A.sort() cost = 0 for i, a in enumerate(A, start=1): cost += abs(i - a) print(cost) main()