n = int(input()) A = list(map(int,input().split())) A = sorted(A) for i in range(len(A)): A[i] -= i+1 print(sum(list(map(abs,A))))