n = int(input()) A = sorted(list(map(int,input().split()))) ans = 0 for i,a in enumerate(A,1): ans += abs(i-a) print(ans)